diff options
Diffstat (limited to 'include/linux/nodemask.h')
| -rw-r--r-- | include/linux/nodemask.h | 67 |
1 files changed, 28 insertions, 39 deletions
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 83a6aeda899d..6e85889cf9ab 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h | |||
| @@ -8,14 +8,13 @@ | |||
| 8 | * See detailed comments in the file linux/bitmap.h describing the | 8 | * See detailed comments in the file linux/bitmap.h describing the |
| 9 | * data type on which these nodemasks are based. | 9 | * data type on which these nodemasks are based. |
| 10 | * | 10 | * |
| 11 | * For details of nodemask_scnprintf() and nodemask_parse_user(), | 11 | * For details of nodemask_parse_user(), see bitmap_parse_user() in |
| 12 | * see bitmap_scnprintf() and bitmap_parse_user() in lib/bitmap.c. | 12 | * lib/bitmap.c. For details of nodelist_parse(), see bitmap_parselist(), |
| 13 | * For details of nodelist_scnprintf() and nodelist_parse(), see | 13 | * also in bitmap.c. For details of node_remap(), see bitmap_bitremap in |
| 14 | * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. | 14 | * lib/bitmap.c. For details of nodes_remap(), see bitmap_remap in |
| 15 | * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c. | 15 | * lib/bitmap.c. For details of nodes_onto(), see bitmap_onto in |
| 16 | * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c. | 16 | * lib/bitmap.c. For details of nodes_fold(), see bitmap_fold in |
| 17 | * For details of nodes_onto(), see bitmap_onto in lib/bitmap.c. | 17 | * lib/bitmap.c. |
| 18 | * For details of nodes_fold(), see bitmap_fold in lib/bitmap.c. | ||
| 19 | * | 18 | * |
| 20 | * The available nodemask operations are: | 19 | * The available nodemask operations are: |
| 21 | * | 20 | * |
| @@ -52,9 +51,7 @@ | |||
| 52 | * NODE_MASK_NONE Initializer - no bits set | 51 | * NODE_MASK_NONE Initializer - no bits set |
| 53 | * unsigned long *nodes_addr(mask) Array of unsigned long's in mask | 52 | * unsigned long *nodes_addr(mask) Array of unsigned long's in mask |
| 54 | * | 53 | * |
| 55 | * int nodemask_scnprintf(buf, len, mask) Format nodemask for printing | ||
| 56 | * int nodemask_parse_user(ubuf, ulen, mask) Parse ascii string as nodemask | 54 | * int nodemask_parse_user(ubuf, ulen, mask) Parse ascii string as nodemask |
| 57 | * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing | ||
| 58 | * int nodelist_parse(buf, map) Parse ascii string as nodelist | 55 | * int nodelist_parse(buf, map) Parse ascii string as nodelist |
| 59 | * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) | 56 | * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) |
| 60 | * void nodes_remap(dst, src, old, new) *dst = map(old, new)(src) | 57 | * void nodes_remap(dst, src, old, new) *dst = map(old, new)(src) |
| @@ -98,6 +95,14 @@ | |||
| 98 | typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; | 95 | typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; |
| 99 | extern nodemask_t _unused_nodemask_arg_; | 96 | extern nodemask_t _unused_nodemask_arg_; |
| 100 | 97 | ||
| 98 | /** | ||
| 99 | * nodemask_pr_args - printf args to output a nodemask | ||
| 100 | * @maskp: nodemask to be printed | ||
| 101 | * | ||
| 102 | * Can be used to provide arguments for '%*pb[l]' when printing a nodemask. | ||
| 103 | */ | ||
| 104 | #define nodemask_pr_args(maskp) MAX_NUMNODES, (maskp)->bits | ||
| 105 | |||
| 101 | /* | 106 | /* |
| 102 | * The inline keyword gives the compiler room to decide to inline, or | 107 | * The inline keyword gives the compiler room to decide to inline, or |
| 103 | * not inline a function as it sees best. However, as these functions | 108 | * not inline a function as it sees best. However, as these functions |
| @@ -120,13 +125,13 @@ static inline void __node_clear(int node, volatile nodemask_t *dstp) | |||
| 120 | } | 125 | } |
| 121 | 126 | ||
| 122 | #define nodes_setall(dst) __nodes_setall(&(dst), MAX_NUMNODES) | 127 | #define nodes_setall(dst) __nodes_setall(&(dst), MAX_NUMNODES) |
| 123 | static inline void __nodes_setall(nodemask_t *dstp, int nbits) | 128 | static inline void __nodes_setall(nodemask_t *dstp, unsigned int nbits) |
| 124 | { | 129 | { |
| 125 | bitmap_fill(dstp->bits, nbits); | 130 | bitmap_fill(dstp->bits, nbits); |
| 126 | } | 131 | } |
| 127 | 132 | ||
| 128 | #define nodes_clear(dst) __nodes_clear(&(dst), MAX_NUMNODES) | 133 | #define nodes_clear(dst) __nodes_clear(&(dst), MAX_NUMNODES) |
| 129 | static inline void __nodes_clear(nodemask_t *dstp, int nbits) | 134 | static inline void __nodes_clear(nodemask_t *dstp, unsigned int nbits) |
| 130 | { | 135 | { |
| 131 | bitmap_zero(dstp->bits, nbits); | 136 | bitmap_zero(dstp->bits, nbits); |
| 132 | } | 137 | } |
| @@ -144,7 +149,7 @@ static inline int __node_test_and_set(int node, nodemask_t *addr) | |||
| 144 | #define nodes_and(dst, src1, src2) \ | 149 | #define nodes_and(dst, src1, src2) \ |
| 145 | __nodes_and(&(dst), &(src1), &(src2), MAX_NUMNODES) | 150 | __nodes_and(&(dst), &(src1), &(src2), MAX_NUMNODES) |
| 146 | static inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p, | 151 | static inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p, |
| 147 | const nodemask_t *src2p, int nbits) | 152 | const nodemask_t *src2p, unsigned int nbits) |
| 148 | { | 153 | { |
| 149 | bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); | 154 | bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); |
| 150 | } | 155 | } |
| @@ -152,7 +157,7 @@ static inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p, | |||
| 152 | #define nodes_or(dst, src1, src2) \ | 157 | #define nodes_or(dst, src1, src2) \ |
| 153 | __nodes_or(&(dst), &(src1), &(src2), MAX_NUMNODES) | 158 | __nodes_or(&(dst), &(src1), &(src2), MAX_NUMNODES) |
| 154 | static inline void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p, | 159 | static inline void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p, |
| 155 | const nodemask_t *src2p, int nbits) | 160 | const nodemask_t *src2p, unsigned int nbits) |
| 156 | { | 161 | { |
| 157 | bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits); | 162 | bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits); |
| 158 | } | 163 | } |
| @@ -160,7 +165,7 @@ static inline void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p, | |||
| 160 | #define nodes_xor(dst, src1, src2) \ | 165 | #define nodes_xor(dst, src1, src2) \ |
| 161 | __nodes_xor(&(dst), &(src1), &(src2), MAX_NUMNODES) | 166 | __nodes_xor(&(dst), &(src1), &(src2), MAX_NUMNODES) |
| 162 | static inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p, | 167 | static inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p, |
| 163 | const nodemask_t *src2p, int nbits) | 168 | const nodemask_t *src2p, unsigned int nbits) |
| 164 | { | 169 | { |
| 165 | bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits); | 170 | bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits); |
| 166 | } | 171 | } |
| @@ -168,7 +173,7 @@ static inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p, | |||
| 168 | #define nodes_andnot(dst, src1, src2) \ | 173 | #define nodes_andnot(dst, src1, src2) \ |
| 169 | __nodes_andnot(&(dst), &(src1), &(src2), MAX_NUMNODES) | 174 | __nodes_andnot(&(dst), &(src1), &(src2), MAX_NUMNODES) |
| 170 | static inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p, | 175 | static inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p, |
| 171 | const nodemask_t *src2p, int nbits) | 176 | const nodemask_t *src2p, unsigned int nbits) |
| 172 | { | 177 | { |
| 173 | bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); | 178 | bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); |
| 174 | } | 179 | } |
| @@ -176,7 +181,7 @@ static inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p, | |||
| 176 | #define nodes_complement(dst, src) \ | 181 | #define nodes_complement(dst, src) \ |
| 177 | __nodes_complement(&(dst), &(src), MAX_NUMNODES) | 182 | __nodes_complement(&(dst), &(src), MAX_NUMNODES) |
| 178 | static inline void __nodes_complement(nodemask_t *dstp, | 183 | static inline void __nodes_complement(nodemask_t *dstp, |
| 179 | const nodemask_t *srcp, int nbits) | 184 | const nodemask_t *srcp, unsigned int nbits) |
| 180 | { | 185 | { |
| 181 | bitmap_complement(dstp->bits, srcp->bits, nbits); | 186 | bitmap_complement(dstp->bits, srcp->bits, nbits); |
| 182 | } | 187 | } |
| @@ -184,7 +189,7 @@ static inline void __nodes_complement(nodemask_t *dstp, | |||
| 184 | #define nodes_equal(src1, src2) \ | 189 | #define nodes_equal(src1, src2) \ |
| 185 | __nodes_equal(&(src1), &(src2), MAX_NUMNODES) | 190 | __nodes_equal(&(src1), &(src2), MAX_NUMNODES) |
| 186 | static inline int __nodes_equal(const nodemask_t *src1p, | 191 | static inline int __nodes_equal(const nodemask_t *src1p, |
| 187 | const nodemask_t *src2p, int nbits) | 192 | const nodemask_t *src2p, unsigned int nbits) |
| 188 | { | 193 | { |
| 189 | return bitmap_equal(src1p->bits, src2p->bits, nbits); | 194 | return bitmap_equal(src1p->bits, src2p->bits, nbits); |
| 190 | } | 195 | } |
| @@ -192,7 +197,7 @@ static inline int __nodes_equal(const nodemask_t *src1p, | |||
| 192 | #define nodes_intersects(src1, src2) \ | 197 | #define nodes_intersects(src1, src2) \ |
| 193 | __nodes_intersects(&(src1), &(src2), MAX_NUMNODES) | 198 | __nodes_intersects(&(src1), &(src2), MAX_NUMNODES) |
| 194 | static inline int __nodes_intersects(const nodemask_t *src1p, | 199 | static inline int __nodes_intersects(const nodemask_t *src1p, |
| 195 | const nodemask_t *src2p, int nbits) | 200 | const nodemask_t *src2p, unsigned int nbits) |
| 196 | { | 201 | { |
| 197 | return bitmap_intersects(src1p->bits, src2p->bits, nbits); | 202 | return bitmap_intersects(src1p->bits, src2p->bits, nbits); |
| 198 | } | 203 | } |
| @@ -200,25 +205,25 @@ static inline int __nodes_intersects(const nodemask_t *src1p, | |||
| 200 | #define nodes_subset(src1, src2) \ | 205 | #define nodes_subset(src1, src2) \ |
| 201 | __nodes_subset(&(src1), &(src2), MAX_NUMNODES) | 206 | __nodes_subset(&(src1), &(src2), MAX_NUMNODES) |
| 202 | static inline int __nodes_subset(const nodemask_t *src1p, | 207 | static inline int __nodes_subset(const nodemask_t *src1p, |
| 203 | const nodemask_t *src2p, int nbits) | 208 | const nodemask_t *src2p, unsigned int nbits) |
| 204 | { | 209 | { |
| 205 | return bitmap_subset(src1p->bits, src2p->bits, nbits); | 210 | return bitmap_subset(src1p->bits, src2p->bits, nbits); |
| 206 | } | 211 | } |
| 207 | 212 | ||
| 208 | #define nodes_empty(src) __nodes_empty(&(src), MAX_NUMNODES) | 213 | #define nodes_empty(src) __nodes_empty(&(src), MAX_NUMNODES) |
| 209 | static inline int __nodes_empty(const nodemask_t *srcp, int nbits) | 214 | static inline int __nodes_empty(const nodemask_t *srcp, unsigned int nbits) |
| 210 | { | 215 | { |
| 211 | return bitmap_empty(srcp->bits, nbits); | 216 | return bitmap_empty(srcp->bits, nbits); |
| 212 | } | 217 | } |
| 213 | 218 | ||
| 214 | #define nodes_full(nodemask) __nodes_full(&(nodemask), MAX_NUMNODES) | 219 | #define nodes_full(nodemask) __nodes_full(&(nodemask), MAX_NUMNODES) |
| 215 | static inline int __nodes_full(const nodemask_t *srcp, int nbits) | 220 | static inline int __nodes_full(const nodemask_t *srcp, unsigned int nbits) |
| 216 | { | 221 | { |
| 217 | return bitmap_full(srcp->bits, nbits); | 222 | return bitmap_full(srcp->bits, nbits); |
| 218 | } | 223 | } |
| 219 | 224 | ||
| 220 | #define nodes_weight(nodemask) __nodes_weight(&(nodemask), MAX_NUMNODES) | 225 | #define nodes_weight(nodemask) __nodes_weight(&(nodemask), MAX_NUMNODES) |
| 221 | static inline int __nodes_weight(const nodemask_t *srcp, int nbits) | 226 | static inline int __nodes_weight(const nodemask_t *srcp, unsigned int nbits) |
| 222 | { | 227 | { |
| 223 | return bitmap_weight(srcp->bits, nbits); | 228 | return bitmap_weight(srcp->bits, nbits); |
| 224 | } | 229 | } |
| @@ -304,14 +309,6 @@ static inline int __first_unset_node(const nodemask_t *maskp) | |||
| 304 | 309 | ||
| 305 | #define nodes_addr(src) ((src).bits) | 310 | #define nodes_addr(src) ((src).bits) |
| 306 | 311 | ||
| 307 | #define nodemask_scnprintf(buf, len, src) \ | ||
| 308 | __nodemask_scnprintf((buf), (len), &(src), MAX_NUMNODES) | ||
| 309 | static inline int __nodemask_scnprintf(char *buf, int len, | ||
| 310 | const nodemask_t *srcp, int nbits) | ||
| 311 | { | ||
| 312 | return bitmap_scnprintf(buf, len, srcp->bits, nbits); | ||
| 313 | } | ||
| 314 | |||
| 315 | #define nodemask_parse_user(ubuf, ulen, dst) \ | 312 | #define nodemask_parse_user(ubuf, ulen, dst) \ |
| 316 | __nodemask_parse_user((ubuf), (ulen), &(dst), MAX_NUMNODES) | 313 | __nodemask_parse_user((ubuf), (ulen), &(dst), MAX_NUMNODES) |
| 317 | static inline int __nodemask_parse_user(const char __user *buf, int len, | 314 | static inline int __nodemask_parse_user(const char __user *buf, int len, |
| @@ -320,14 +317,6 @@ static inline int __nodemask_parse_user(const char __user *buf, int len, | |||
| 320 | return bitmap_parse_user(buf, len, dstp->bits, nbits); | 317 | return bitmap_parse_user(buf, len, dstp->bits, nbits); |
| 321 | } | 318 | } |
| 322 | 319 | ||
| 323 | #define nodelist_scnprintf(buf, len, src) \ | ||
| 324 | __nodelist_scnprintf((buf), (len), &(src), MAX_NUMNODES) | ||
| 325 | static inline int __nodelist_scnprintf(char *buf, int len, | ||
| 326 | const nodemask_t *srcp, int nbits) | ||
| 327 | { | ||
| 328 | return bitmap_scnlistprintf(buf, len, srcp->bits, nbits); | ||
| 329 | } | ||
| 330 | |||
| 331 | #define nodelist_parse(buf, dst) __nodelist_parse((buf), &(dst), MAX_NUMNODES) | 320 | #define nodelist_parse(buf, dst) __nodelist_parse((buf), &(dst), MAX_NUMNODES) |
| 332 | static inline int __nodelist_parse(const char *buf, nodemask_t *dstp, int nbits) | 321 | static inline int __nodelist_parse(const char *buf, nodemask_t *dstp, int nbits) |
| 333 | { | 322 | { |
