diff options
Diffstat (limited to 'include/linux/nodemask.h')
| -rw-r--r-- | include/linux/nodemask.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index e96fe9062500..4726ef7ba8e8 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h | |||
| @@ -12,6 +12,8 @@ | |||
| 12 | * see bitmap_scnprintf() and bitmap_parse() in lib/bitmap.c. | 12 | * see bitmap_scnprintf() and bitmap_parse() in lib/bitmap.c. |
| 13 | * For details of nodelist_scnprintf() and nodelist_parse(), see | 13 | * For details of nodelist_scnprintf() and nodelist_parse(), see |
| 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. | ||
| 16 | * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c. | ||
| 15 | * | 17 | * |
| 16 | * The available nodemask operations are: | 18 | * The available nodemask operations are: |
| 17 | * | 19 | * |
| @@ -52,6 +54,8 @@ | |||
| 52 | * int nodemask_parse(ubuf, ulen, mask) Parse ascii string as nodemask | 54 | * int nodemask_parse(ubuf, ulen, mask) Parse ascii string as nodemask |
| 53 | * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing | 55 | * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing |
| 54 | * int nodelist_parse(buf, map) Parse ascii string as nodelist | 56 | * int nodelist_parse(buf, map) Parse ascii string as nodelist |
| 57 | * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) | ||
| 58 | * int nodes_remap(dst, src, old, new) *dst = map(old, new)(dst) | ||
| 55 | * | 59 | * |
| 56 | * for_each_node_mask(node, mask) for-loop node over mask | 60 | * for_each_node_mask(node, mask) for-loop node over mask |
| 57 | * | 61 | * |
| @@ -307,6 +311,22 @@ static inline int __nodelist_parse(const char *buf, nodemask_t *dstp, int nbits) | |||
| 307 | return bitmap_parselist(buf, dstp->bits, nbits); | 311 | return bitmap_parselist(buf, dstp->bits, nbits); |
| 308 | } | 312 | } |
| 309 | 313 | ||
| 314 | #define node_remap(oldbit, old, new) \ | ||
| 315 | __node_remap((oldbit), &(old), &(new), MAX_NUMNODES) | ||
| 316 | static inline int __node_remap(int oldbit, | ||
| 317 | const nodemask_t *oldp, const nodemask_t *newp, int nbits) | ||
| 318 | { | ||
| 319 | return bitmap_bitremap(oldbit, oldp->bits, newp->bits, nbits); | ||
| 320 | } | ||
| 321 | |||
| 322 | #define nodes_remap(dst, src, old, new) \ | ||
| 323 | __nodes_remap(&(dst), &(src), &(old), &(new), MAX_NUMNODES) | ||
| 324 | static inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp, | ||
| 325 | const nodemask_t *oldp, const nodemask_t *newp, int nbits) | ||
| 326 | { | ||
| 327 | bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); | ||
| 328 | } | ||
| 329 | |||
| 310 | #if MAX_NUMNODES > 1 | 330 | #if MAX_NUMNODES > 1 |
| 311 | #define for_each_node_mask(node, mask) \ | 331 | #define for_each_node_mask(node, mask) \ |
| 312 | for ((node) = first_node(mask); \ | 332 | for ((node) = first_node(mask); \ |
