Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/bitset.h
Show First 20 Lines • Show All 306 Lines • ▼ Show 20 Lines | #define __BITSET_FSET(n) \ | ||||||||
[ 0 ... ((n) - 1) ] = (-1L) | [ 0 ... ((n) - 1) ] = (-1L) | ||||||||
#define __BITSET_SIZE(_s) (__bitset_words((_s)) * sizeof(long)) | #define __BITSET_SIZE(_s) (__bitset_words((_s)) * sizeof(long)) | ||||||||
#if defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) | #if defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) | ||||||||
/* | /* | ||||||||
* Dynamically allocate a bitset. | * Dynamically allocate a bitset. | ||||||||
*/ | */ | ||||||||
#if defined(_KERNEL) | |||||||||
#define __BITSET_ALLOC(_s, mt, mf) malloc(__BITSET_SIZE((_s)), mt, (mf)) | #define __BITSET_ALLOC(_s, mt, mf) malloc(__BITSET_SIZE((_s)), mt, (mf)) | ||||||||
#define __BITSET_FREE(p, mt) free(p, mt) | |||||||||
#else /* _KERNEL */ | |||||||||
#define __BITSET_ALLOC(_s) malloc(__BITSET_SIZE((_s))) | |||||||||
#define __BITSET_FREE(p) free(p) | |||||||||
kib: You do not need to define usermode-allocating __BITSET_ALLOC. Only BITSET_ALLOC. | |||||||||
Done Inline ActionsI had added these defines in this way for symmetry reasons, not due to actual uses in code I know of. In fact, I do not know of any single use of BITSEC_ALLOC() in usermode code, and I guess it should not be defined outside _KERNEL at all. se: I had added these defines in this way for symmetry reasons, not due to actual uses in code I… | |||||||||
Done Inline ActionsCPU_ALLOC in sys/cpuset.h is currently based on BITSEC_ALLOC and is a user-land only function. se: CPU_ALLOC in sys/cpuset.h is currently based on __BITSEC_ALLOC and is a user-land only… | |||||||||
#endif /* _KERNEL */ | |||||||||
#define BIT_AND(_s, d, s) __BIT_AND(_s, d, s) | #define BIT_AND(_s, d, s) __BIT_AND(_s, d, s) | ||||||||
#define BIT_AND2(_s, d, s1, s2) __BIT_AND2(_s, d, s1, s2) | #define BIT_AND2(_s, d, s1, s2) __BIT_AND2(_s, d, s1, s2) | ||||||||
#define BIT_ANDNOT(_s, d, s) __BIT_ANDNOT(_s, d, s) | #define BIT_ANDNOT(_s, d, s) __BIT_ANDNOT(_s, d, s) | ||||||||
#define BIT_ANDNOT2(_s, d, s1, s2) __BIT_ANDNOT2(_s, d, s1, s2) | #define BIT_ANDNOT2(_s, d, s1, s2) __BIT_ANDNOT2(_s, d, s1, s2) | ||||||||
#define BIT_AND_ATOMIC(_s, d, s) __BIT_AND_ATOMIC(_s, d, s) | #define BIT_AND_ATOMIC(_s, d, s) __BIT_AND_ATOMIC(_s, d, s) | ||||||||
#define BIT_CLR(_s, n, p) __BIT_CLR(_s, n, p) | #define BIT_CLR(_s, n, p) __BIT_CLR(_s, n, p) | ||||||||
#define BIT_CLR_ATOMIC(_s, n, p) __BIT_CLR_ATOMIC(_s, n, p) | #define BIT_CLR_ATOMIC(_s, n, p) __BIT_CLR_ATOMIC(_s, n, p) | ||||||||
Show All 23 Lines | |||||||||
#define BIT_SUBSET(_s, p, c) __BIT_SUBSET(_s, p, c) | #define BIT_SUBSET(_s, p, c) __BIT_SUBSET(_s, p, c) | ||||||||
#define BIT_TEST_CLR_ATOMIC(_s, n, p) __BIT_TEST_CLR_ATOMIC(_s, n, p) | #define BIT_TEST_CLR_ATOMIC(_s, n, p) __BIT_TEST_CLR_ATOMIC(_s, n, p) | ||||||||
#define BIT_TEST_SET_ATOMIC(_s, n, p) __BIT_TEST_SET_ATOMIC(_s, n, p) | #define BIT_TEST_SET_ATOMIC(_s, n, p) __BIT_TEST_SET_ATOMIC(_s, n, p) | ||||||||
#define BIT_XOR(_s, d, s) __BIT_XOR(_s, d, s) | #define BIT_XOR(_s, d, s) __BIT_XOR(_s, d, s) | ||||||||
#define BIT_XOR2(_s, d, s1, s2) __BIT_XOR2(_s, d, s1, s2) | #define BIT_XOR2(_s, d, s1, s2) __BIT_XOR2(_s, d, s1, s2) | ||||||||
#define BIT_ZERO(_s, p) __BIT_ZERO(_s, p) | #define BIT_ZERO(_s, p) __BIT_ZERO(_s, p) | ||||||||
#define BITSET_ALLOC(_s, mt, mf) __BITSET_ALLOC(_s, mt, mf) | #define BITSET_ALLOC(_s, mt, mf) __BITSET_ALLOC(_s, mt, mf) | ||||||||
#define BITSET_FREE(p) __BITSET_FREE(p) | |||||||||
Done Inline Actions
The definition of BITSET_FREE in the latest patch set did not contain the allocation type parameter "mt". This will be fixed in the final version. se: The definition of BITSET_FREE in the latest patch set did not contain the allocation type… | |||||||||
#define BITSET_FSET(n) __BITSET_FSET(n) | #define BITSET_FSET(n) __BITSET_FSET(n) | ||||||||
#define BITSET_SIZE(_s) __BITSET_SIZE(_s) | #define BITSET_SIZE(_s) __BITSET_SIZE(_s) | ||||||||
#define BITSET_T_INITIALIZER(x) __BITSET_T_INITIALIZER(x) | #define BITSET_T_INITIALIZER(x) __BITSET_T_INITIALIZER(x) | ||||||||
#endif /* defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) */ | #endif /* defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) */ | ||||||||
#endif /* !_SYS_BITSET_H_ */ | #endif /* !_SYS_BITSET_H_ */ |
You do not need to define usermode-allocating __BITSET_ALLOC. Only BITSET_ALLOC.