@@ -91,15 +91,15 @@ struct bitfield {
bitfield_t bits[];
};
-#define STATIC_BITFIELD(name, length) \
- static struct { \
+#define BITFIELD(name, length) \
+ struct { \
unsigned int len; \
bitfield_t bits[((length) - 1) / bits_per_slot + 1]; \
- } __static__ ## name = { \
+ } __storage_for__ ## name = { \
.len = (length), \
.bits = { 0, }, \
}; \
- struct bitfield *name = (struct bitfield *)& __static__ ## name
+ struct bitfield *name = (struct bitfield *)& __storage_for__ ## name
struct bitfield *alloc_bitfield(unsigned int maxbit);
@@ -875,7 +875,7 @@ sysfs_set_nexus_loss_tmo(struct path *pp)
static void
scsi_tmo_error_msg(struct path *pp)
{
- STATIC_BITFIELD(bf, LAST_BUS_PROTOCOL_ID + 1);
+ static BITFIELD(bf, LAST_BUS_PROTOCOL_ID + 1);
STRBUF_ON_STACK(proto_buf);
unsigned int proto_id = bus_protocol_id(pp);
A non-dynamically allocated bitfield doesn't have to have static scope, it can also be a local variable on the stack. Change the macro such that it can also be used for the latter case. Signed-off-by: Martin Wilck <mwilck@suse.com> --- libmpathutil/util.h | 8 ++++---- libmultipath/discovery.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)