diff options
-rw-r--r-- | include/linux/cpumask.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 2dbd9a287e77..72f9c32c12b0 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -75,6 +75,17 @@ | |||
75 | * CPU_MASK_NONE Initializer - no bits set | 75 | * CPU_MASK_NONE Initializer - no bits set |
76 | * unsigned long *cpus_addr(mask) Array of unsigned long's in mask | 76 | * unsigned long *cpus_addr(mask) Array of unsigned long's in mask |
77 | * | 77 | * |
78 | *if NR_CPUS > BITS_PER_LONG | ||
79 | * CPUMASK_ALLOC(m) Declares and allocates struct m *m = | ||
80 | * (struct m *)kmalloc(sizeof(*m), ...) | ||
81 | * CPUMASK_FREE(m) Macro for kfree(v) | ||
82 | *else | ||
83 | * CPUMASK_ALLOC(m) Declares struct m _m, *m = &_m | ||
84 | * CPUMASK_FREE(m) Nop | ||
85 | *endif | ||
86 | * CPUMASK_VAR(v, m) Declares cpumask_t *v = | ||
87 | * m + offset(struct m, v) | ||
88 | * | ||
78 | * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing | 89 | * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing |
79 | * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask | 90 | * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask |
80 | * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing | 91 | * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing |
@@ -311,6 +322,16 @@ extern cpumask_t cpu_mask_all; | |||
311 | 322 | ||
312 | #define cpus_addr(src) ((src).bits) | 323 | #define cpus_addr(src) ((src).bits) |
313 | 324 | ||
325 | #if NR_CPUS > BITS_PER_LONG | ||
326 | #define CPUMASK_ALLOC(m) struct m *m = kmalloc(sizeof(*m), GFP_KERNEL) | ||
327 | #define CPUMASK_FREE(m) kfree(m) | ||
328 | #else | ||
329 | #define CPUMASK_ALLOC(m) struct allmasks _m, *m = &_m | ||
330 | #define CPUMASK_FREE(m) | ||
331 | #endif | ||
332 | #define CPUMASK_VAR(v, m) cpumask_t *v = (cpumask_t *) \ | ||
333 | ((unsigned long)(m) + offsetof(struct m, v)) | ||
334 | |||
314 | #define cpumask_scnprintf(buf, len, src) \ | 335 | #define cpumask_scnprintf(buf, len, src) \ |
315 | __cpumask_scnprintf((buf), (len), &(src), NR_CPUS) | 336 | __cpumask_scnprintf((buf), (len), &(src), NR_CPUS) |
316 | static inline int __cpumask_scnprintf(char *buf, int len, | 337 | static inline int __cpumask_scnprintf(char *buf, int len, |