1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef __LINUX_NODEMASK_H 20 #define __LINUX_NODEMASK_H 21 #include <linux/kernel.h> 22 #include <linux/threads.h> 23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24 #include <linux/bitmap.h> 25 #include <linux/numa.h> 26 typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; 27 #define node_set(node, dst) __node_set((node), &(dst)) 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 #define node_clear(node, dst) __node_clear((node), &(dst)) 30 #define nodes_setall(dst) __nodes_setall(&(dst), MAX_NUMNODES) 31 #define nodes_clear(dst) __nodes_clear(&(dst), MAX_NUMNODES) 32 #define node_isset(node, nodemask) test_bit((node), (nodemask).bits) 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 #define node_test_and_set(node, nodemask) __node_test_and_set((node), &(nodemask)) 35 #define nodes_and(dst, src1, src2) __nodes_and(&(dst), &(src1), &(src2), MAX_NUMNODES) 36 #define nodes_or(dst, src1, src2) __nodes_or(&(dst), &(src1), &(src2), MAX_NUMNODES) 37 #define nodes_xor(dst, src1, src2) __nodes_xor(&(dst), &(src1), &(src2), MAX_NUMNODES) 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 #define nodes_andnot(dst, src1, src2) __nodes_andnot(&(dst), &(src1), &(src2), MAX_NUMNODES) 40 #define nodes_complement(dst, src) __nodes_complement(&(dst), &(src), MAX_NUMNODES) 41 #define nodes_equal(src1, src2) __nodes_equal(&(src1), &(src2), MAX_NUMNODES) 42 #define nodes_intersects(src1, src2) __nodes_intersects(&(src1), &(src2), MAX_NUMNODES) 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 #define nodes_subset(src1, src2) __nodes_subset(&(src1), &(src2), MAX_NUMNODES) 45 #define nodes_empty(src) __nodes_empty(&(src), MAX_NUMNODES) 46 #define nodes_full(nodemask) __nodes_full(&(nodemask), MAX_NUMNODES) 47 #define nodes_weight(nodemask) __nodes_weight(&(nodemask), MAX_NUMNODES) 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 #define nodes_shift_right(dst, src, n) __nodes_shift_right(&(dst), &(src), (n), MAX_NUMNODES) 50 #define nodes_shift_left(dst, src, n) __nodes_shift_left(&(dst), &(src), (n), MAX_NUMNODES) 51 #define first_node(src) __first_node(&(src)) 52 #define next_node(n, src) __next_node((n), &(src)) 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 #define nodemask_of_node(node) ({ typeof(_unused_nodemask_arg_) m; if (sizeof(m) == sizeof(unsigned long)) { m.bits[0] = 1UL<<(node); } else { nodes_clear(m); node_set((node), m); } m; }) 55 #define first_unset_node(mask) __first_unset_node(&(mask)) 56 #define NODE_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(MAX_NUMNODES) 57 #if MAX_NUMNODES <= BITS_PER_LONG 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 #define NODE_MASK_ALL ((nodemask_t) { { [BITS_TO_LONGS(MAX_NUMNODES)-1] = NODE_MASK_LAST_WORD } }) 60 #else 61 #define NODE_MASK_ALL ((nodemask_t) { { [0 ... BITS_TO_LONGS(MAX_NUMNODES)-2] = ~0UL, [BITS_TO_LONGS(MAX_NUMNODES)-1] = NODE_MASK_LAST_WORD } }) 62 #endif 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 #define NODE_MASK_NONE ((nodemask_t) { { [0 ... BITS_TO_LONGS(MAX_NUMNODES)-1] = 0UL } }) 65 #define nodes_addr(src) ((src).bits) 66 #define nodemask_scnprintf(buf, len, src) __nodemask_scnprintf((buf), (len), &(src), MAX_NUMNODES) 67 #define nodemask_parse(ubuf, ulen, dst) __nodemask_parse((ubuf), (ulen), &(dst), MAX_NUMNODES) 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 #define nodelist_scnprintf(buf, len, src) __nodelist_scnprintf((buf), (len), &(src), MAX_NUMNODES) 70 #define nodelist_parse(buf, dst) __nodelist_parse((buf), &(dst), MAX_NUMNODES) 71 #define node_remap(oldbit, old, new) __node_remap((oldbit), &(old), &(new), MAX_NUMNODES) 72 #define nodes_remap(dst, src, old, new) __nodes_remap(&(dst), &(src), &(old), &(new), MAX_NUMNODES) 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 #if MAX_NUMNODES > 1 75 #define for_each_node_mask(node, mask) for ((node) = first_node(mask); (node) < MAX_NUMNODES; (node) = next_node((node), (mask))) 76 #else 77 #define for_each_node_mask(node, mask) if (!nodes_empty(mask)) for ((node) = 0; (node) < 1; (node)++) 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 #endif 80 #if MAX_NUMNODES > 1 81 #define num_online_nodes() nodes_weight(node_online_map) 82 #define num_possible_nodes() nodes_weight(node_possible_map) 83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84 #define node_online(node) node_isset((node), node_online_map) 85 #define node_possible(node) node_isset((node), node_possible_map) 86 #define first_online_node first_node(node_online_map) 87 #define next_online_node(nid) next_node((nid), node_online_map) 88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89 #else 90 #define num_online_nodes() 1 91 #define num_possible_nodes() 1 92 #define node_online(node) ((node) == 0) 93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 94 #define node_possible(node) ((node) == 0) 95 #define first_online_node 0 96 #define next_online_node(nid) (MAX_NUMNODES) 97 #endif 98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 99 #define any_online_node(mask) ({ int node; for_each_node_mask(node, (mask)) if (node_online(node)) break; node; }) 100 #define node_set_online(node) set_bit((node), node_online_map.bits) 101 #define node_set_offline(node) clear_bit((node), node_online_map.bits) 102 #define for_each_node(node) for_each_node_mask((node), node_possible_map) 103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 104 #define for_each_online_node(node) for_each_node_mask((node), node_online_map) 105 #endif 106