#define __unpack_flag(_set, _f, _m) _f
#define unpack_vcpu_flag(...) __unpack_flag(__VA_ARGS__)
+#define __build_check_flag(v, flagset, f, m) \
+ do { \
+ typeof(v->arch.flagset) *_fset; \
+ \
+ /* Check that the flags fit in the mask */ \
+ BUILD_BUG_ON(HWEIGHT(m) != HWEIGHT((f) | (m))); \
+ /* Check that the flags fit in the type */ \
+ BUILD_BUG_ON((sizeof(*_fset) * 8) <= __fls(m)); \
+ } while (0)
+
#define __vcpu_get_flag(v, flagset, f, m) \
({ \
+ __build_check_flag(v, flagset, f, m); \
+ \
v->arch.flagset & (m); \
})
do { \
typeof(v->arch.flagset) *fset; \
\
+ __build_check_flag(v, flagset, f, m); \
+ \
fset = &v->arch.flagset; \
if (HWEIGHT(m) > 1) \
*fset &= ~(m); \
do { \
typeof(v->arch.flagset) *fset; \
\
+ __build_check_flag(v, flagset, f, m); \
+ \
fset = &v->arch.flagset; \
*fset &= ~(m); \
} while (0)