-
Notifications
You must be signed in to change notification settings - Fork 9
/
compat.h
39 lines (33 loc) · 874 Bytes
/
compat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __bitmap_set
#define __bitmap_set(a, b, c) bitmap_set(a, b, c)
#endif
#ifndef __bitmap_clear
#define __bitmap_clear(a, b, c) bitmap_clear(a, b, c)
#endif
/*
* Copy from include/linux/compiler_attributes.h
*/
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
#ifndef fallthrough
#if __has_attribute(__fallthrough__)
#define fallthrough __attribute__((__fallthrough__))
#else
#define fallthrough do {} while (0) /* fallthrough */
#endif
#endif
/*
* Copy from include/linux/build_bug.h
*/
#ifndef static_assert
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
#endif
/*
* Copy from include/linux/overflow.h
*/
#ifndef struct_size
#define struct_size(p, member, n) (sizeof(*(p)) + n * sizeof(*(p)->member))
#endif