Rev 6936 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6936 | Rev 7143 | ||
---|---|---|---|
Line 18... | Line 18... | ||
18 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) |
18 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) |
19 | # define __percpu __attribute__((noderef, address_space(3))) |
19 | # define __percpu __attribute__((noderef, address_space(3))) |
20 | # define __pmem __attribute__((noderef, address_space(5))) |
20 | # define __pmem __attribute__((noderef, address_space(5))) |
21 | #ifdef CONFIG_SPARSE_RCU_POINTER |
21 | #ifdef CONFIG_SPARSE_RCU_POINTER |
22 | # define __rcu __attribute__((noderef, address_space(4))) |
22 | # define __rcu __attribute__((noderef, address_space(4))) |
23 | #else |
23 | #else /* CONFIG_SPARSE_RCU_POINTER */ |
24 | # define __rcu |
24 | # define __rcu |
25 | #endif |
25 | #endif /* CONFIG_SPARSE_RCU_POINTER */ |
- | 26 | # define __private __attribute__((noderef)) |
|
26 | extern void __chk_user_ptr(const volatile void __user *); |
27 | extern void __chk_user_ptr(const volatile void __user *); |
27 | extern void __chk_io_ptr(const volatile void __iomem *); |
28 | extern void __chk_io_ptr(const volatile void __iomem *); |
- | 29 | # define ACCESS_PRIVATE(p, member) (*((typeof((p)->member) __force *) &(p)->member)) |
|
28 | #else |
30 | #else /* __CHECKER__ */ |
29 | # define __user |
31 | # define __user |
30 | # define __kernel |
32 | # define __kernel |
31 | # define __safe |
33 | # define __safe |
32 | # define __force |
34 | # define __force |
33 | # define __nocast |
35 | # define __nocast |
Line 42... | Line 44... | ||
42 | # define __release(x) (void)0 |
44 | # define __release(x) (void)0 |
43 | # define __cond_lock(x,c) (c) |
45 | # define __cond_lock(x,c) (c) |
44 | # define __percpu |
46 | # define __percpu |
45 | # define __rcu |
47 | # define __rcu |
46 | # define __pmem |
48 | # define __pmem |
47 | #endif |
49 | # define __private |
- | 50 | # define ACCESS_PRIVATE(p, member) ((p)->member) |
|
- | 51 | #endif /* __CHECKER__ */ |
|
Line 48... | Line 52... | ||
48 | 52 | ||
49 | /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ |
53 | /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ |
50 | #define ___PASTE(a,b) a##b |
54 | #define ___PASTE(a,b) a##b |
Line 261... | Line 265... | ||
261 | * WRITE_ONCE or ACCESS_ONCE() in different C statements. |
265 | * WRITE_ONCE or ACCESS_ONCE() in different C statements. |
262 | * |
266 | * |
263 | * In contrast to ACCESS_ONCE these two macros will also work on aggregate |
267 | * In contrast to ACCESS_ONCE these two macros will also work on aggregate |
264 | * data types like structs or unions. If the size of the accessed data |
268 | * data types like structs or unions. If the size of the accessed data |
265 | * type exceeds the word size of the machine (e.g., 32 bits or 64 bits) |
269 | * type exceeds the word size of the machine (e.g., 32 bits or 64 bits) |
266 | * READ_ONCE() and WRITE_ONCE() will fall back to memcpy and print a |
270 | * READ_ONCE() and WRITE_ONCE() will fall back to memcpy(). There's at |
- | 271 | * least two memcpy()s: one for the __builtin_memcpy() and then one for |
|
267 | * compile-time warning. |
272 | * the macro doing the copy of variable - '__u' allocated on the stack. |
268 | * |
273 | * |
269 | * Their two major use cases are: (1) Mediating communication between |
274 | * Their two major use cases are: (1) Mediating communication between |
270 | * process-level code and irq/NMI handlers, all running on the same CPU, |
275 | * process-level code and irq/NMI handlers, all running on the same CPU, |
271 | * and (2) Ensuring that the compiler does not fold, spindle, or otherwise |
276 | * and (2) Ensuring that the compiler does not fold, spindle, or otherwise |
272 | * mutilate accesses that either do not require ordering or that interact |
277 | * mutilate accesses that either do not require ordering or that interact |