Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
#ifndef __ASM_GENERIC_CPUMASK_ARITH_H
2
#define __ASM_GENERIC_CPUMASK_ARITH_H
3
 
4
/*
5
 * Arithmetic type -based cpu bitmaps. A single unsigned long is used
6
 * to contain the whole cpu bitmap.
7
 */
8
 
9
#define cpu_set(cpu, map)               set_bit(cpu, &(map))
10
#define cpu_clear(cpu, map)             clear_bit(cpu, &(map))
11
#define cpu_isset(cpu, map)             test_bit(cpu, &(map))
12
#define cpu_test_and_set(cpu, map)      test_and_set_bit(cpu, &(map))
13
 
14
#define cpus_and(dst,src1,src2)         do { dst = (src1) & (src2); } while (0)
15
#define cpus_or(dst,src1,src2)          do { dst = (src1) | (src2); } while (0)
16
#define cpus_clear(map)                 do { map = 0; } while (0)
17
#define cpus_complement(map)            do { map = ~(map); } while (0)
18
#define cpus_equal(map1, map2)          ((map1) == (map2))
19
#define cpus_empty(map)                 ((map) == 0)
20
 
21
#if BITS_PER_LONG == 32
22
#define cpus_weight(map)                hweight32(map)
23
#elif BITS_PER_LONG == 64
24
#define cpus_weight(map)                hweight64(map)
25
#endif
26
 
27
#define cpus_shift_right(dst, src, n)   do { dst = (src) >> (n); } while (0)
28
#define cpus_shift_left(dst, src, n)    do { dst = (src) << (n); } while (0)
29
 
30
#define any_online_cpu(map)                     \
31
({                                              \
32
        cpumask_t __tmp__;                      \
33
        cpus_and(__tmp__, map, cpu_online_map); \
34
        __tmp__ ? first_cpu(__tmp__) : NR_CPUS; \
35
})
36
 
37
#define CPU_MASK_ALL    (~((cpumask_t)0) >> (8*sizeof(cpumask_t) - NR_CPUS))
38
#define CPU_MASK_NONE   ((cpumask_t)0)
39
 
40
/* only ever use this for things that are _never_ used on large boxen */
41
#define cpus_coerce(map)                ((unsigned long)(map))
42
#define cpus_promote(map)               ({ map; })
43
#define cpumask_of_cpu(cpu)             ({ ((cpumask_t)1) << (cpu); })
44
 
45
#define first_cpu(map)                  __ffs(map)
46
#define next_cpu(cpu, map)              find_next_bit(&(map), NR_CPUS, cpu + 1)
47
 
48
#endif /* __ASM_GENERIC_CPUMASK_ARITH_H */