diff options
Diffstat (limited to 'include/linux/nodemask.h')
-rw-r--r-- | include/linux/nodemask.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 905e18f4b412..848025cd7087 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h | |||
@@ -14,6 +14,8 @@ | |||
14 | * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. | 14 | * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. |
15 | * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c. | 15 | * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c. |
16 | * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c. | 16 | * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c. |
17 | * For details of nodes_onto(), see bitmap_onto in lib/bitmap.c. | ||
18 | * For details of nodes_fold(), see bitmap_fold in lib/bitmap.c. | ||
17 | * | 19 | * |
18 | * The available nodemask operations are: | 20 | * The available nodemask operations are: |
19 | * | 21 | * |
@@ -55,7 +57,9 @@ | |||
55 | * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing | 57 | * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing |
56 | * int nodelist_parse(buf, map) Parse ascii string as nodelist | 58 | * int nodelist_parse(buf, map) Parse ascii string as nodelist |
57 | * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) | 59 | * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) |
58 | * int nodes_remap(dst, src, old, new) *dst = map(old, new)(dst) | 60 | * void nodes_remap(dst, src, old, new) *dst = map(old, new)(src) |
61 | * void nodes_onto(dst, orig, relmap) *dst = orig relative to relmap | ||
62 | * void nodes_fold(dst, orig, sz) dst bits = orig bits mod sz | ||
59 | * | 63 | * |
60 | * for_each_node_mask(node, mask) for-loop node over mask | 64 | * for_each_node_mask(node, mask) for-loop node over mask |
61 | * | 65 | * |
@@ -326,6 +330,22 @@ static inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp, | |||
326 | bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); | 330 | bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); |
327 | } | 331 | } |
328 | 332 | ||
333 | #define nodes_onto(dst, orig, relmap) \ | ||
334 | __nodes_onto(&(dst), &(orig), &(relmap), MAX_NUMNODES) | ||
335 | static inline void __nodes_onto(nodemask_t *dstp, const nodemask_t *origp, | ||
336 | const nodemask_t *relmapp, int nbits) | ||
337 | { | ||
338 | bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits); | ||
339 | } | ||
340 | |||
341 | #define nodes_fold(dst, orig, sz) \ | ||
342 | __nodes_fold(&(dst), &(orig), sz, MAX_NUMNODES) | ||
343 | static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp, | ||
344 | int sz, int nbits) | ||
345 | { | ||
346 | bitmap_fold(dstp->bits, origp->bits, sz, nbits); | ||
347 | } | ||
348 | |||
329 | #if MAX_NUMNODES > 1 | 349 | #if MAX_NUMNODES > 1 |
330 | #define for_each_node_mask(node, mask) \ | 350 | #define for_each_node_mask(node, mask) \ |
331 | for ((node) = first_node(mask); \ | 351 | for ((node) = first_node(mask); \ |