This lets you test a feature succintly by name, *AND* makes use of the
FEATUREMASK so that it can be used on bitmasks that may come from old
versions with prior usages of the bit. This makes it usable for data
type encoding or with client-provided bits.
Signed-off-by: Sage Weil <sage@redhat.com>
#define DEFINE_CEPH_FEATURE_RETIRED(bit, inc, name, unused, unadvertised)
+// test for a feature. this test is safer than a typical mask against
+// the bit because it ensures that we have the bit AND the marker for the
+// bit's incarnation. this must be used in any case where the features
+// bits may include an old meaning of the bit.
+#define HAVE_FEATURE(x, name) \
+ (((x) & (CEPH_FEATUREMASK_##name)) == (CEPH_FEATUREMASK_##name))
+
/*
* Notes on deprecation: