OSDN Git Service

Check in released NDK version r4.
[android-x86/prebuilt.git] / ndk / android-ndk-r4 / linux / platforms / android-4 / arch-arm / usr / include / linux / cpumask.h
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  ****************************************************************************
11  ****************************************************************************/
12 #ifndef __LINUX_CPUMASK_H
13 #define __LINUX_CPUMASK_H
14
15 #include <linux/kernel.h>
16 #include <linux/threads.h>
17 #include <linux/bitmap.h>
18
19 typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
20
21 #define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
22 #define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))
23 #define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
24 #define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
25 #define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
26 #define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask))
27 #define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
28 #define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
29 #define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
30 #define cpus_andnot(dst, src1, src2)   __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
31 #define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS)
32 #define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
33 #define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
34 #define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
35 #define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
36 #define cpus_full(cpumask) __cpus_full(&(cpumask), NR_CPUS)
37 #define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
38 #define cpus_shift_right(dst, src, n)   __cpus_shift_right(&(dst), &(src), (n), NR_CPUS)
39 #define cpus_shift_left(dst, src, n)   __cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
40 #define first_cpu(src) 0
41 #define next_cpu(n, src) 1
42 #define cpumask_of_cpu(cpu)  ({   typeof(_unused_cpumask_arg_) m;   if (sizeof(m) == sizeof(unsigned long)) {   m.bits[0] = 1UL<<(cpu);   } else {   cpus_clear(m);   cpu_set((cpu), m);   }   m;  })
43 #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
44 #if NR_CPUS <= BITS_PER_LONG
45 #define CPU_MASK_ALL  (cpumask_t) { {   [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD  } }
46 #else
47 #define CPU_MASK_ALL  (cpumask_t) { {   [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL,   [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD  } }
48 #endif
49 #define CPU_MASK_NONE  (cpumask_t) { {   [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL  } }
50 #define CPU_MASK_CPU0  (cpumask_t) { {   [0] = 1UL  } }
51 #define cpus_addr(src) ((src).bits)
52 #define cpumask_scnprintf(buf, len, src)   __cpumask_scnprintf((buf), (len), &(src), NR_CPUS)
53 #define cpumask_parse(ubuf, ulen, dst)   __cpumask_parse((ubuf), (ulen), &(dst), NR_CPUS)
54 #define cpulist_scnprintf(buf, len, src)   __cpulist_scnprintf((buf), (len), &(src), NR_CPUS)
55 #define cpulist_parse(buf, dst) __cpulist_parse((buf), &(dst), NR_CPUS)
56 #define cpu_remap(oldbit, old, new)   __cpu_remap((oldbit), &(old), &(new), NR_CPUS)
57 #define cpus_remap(dst, src, old, new)   __cpus_remap(&(dst), &(src), &(old), &(new), NR_CPUS)
58 #if NR_CPUS > 1
59 #define for_each_cpu_mask(cpu, mask)   for ((cpu) = first_cpu(mask);   (cpu) < NR_CPUS;   (cpu) = next_cpu((cpu), (mask)))
60 #else
61 #define for_each_cpu_mask(cpu, mask)   for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
62 #endif
63
64 #if NR_CPUS > 1
65 #define num_online_cpus() cpus_weight(cpu_online_map)
66 #define num_possible_cpus() cpus_weight(cpu_possible_map)
67 #define num_present_cpus() cpus_weight(cpu_present_map)
68 #define cpu_online(cpu) cpu_isset((cpu), cpu_online_map)
69 #define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map)
70 #define cpu_present(cpu) cpu_isset((cpu), cpu_present_map)
71 #else
72 #define num_online_cpus() 1
73 #define num_possible_cpus() 1
74 #define num_present_cpus() 1
75 #define cpu_online(cpu) ((cpu) == 0)
76 #define cpu_possible(cpu) ((cpu) == 0)
77 #define cpu_present(cpu) ((cpu) == 0)
78 #endif
79
80 #define highest_possible_processor_id() 0
81 #define any_online_cpu(mask) 0
82
83 #define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
84 #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map)
85 #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
86
87 #endif