diff mbox series

[v2,2/8] libmpathutil: change STATIC_BITFIELD to BITFIELD

Message ID 20241127230430.139639-3-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: Benjamin Marzinski
Headers show
Series multipath-tools fixes | expand

Commit Message

Martin Wilck Nov. 27, 2024, 11:04 p.m. UTC
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(-)
diff mbox series

Patch

diff --git a/libmpathutil/util.h b/libmpathutil/util.h
index b1772e3..df7f91e 100644
--- a/libmpathutil/util.h
+++ b/libmpathutil/util.h
@@ -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);
 
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index b585156..2be1f5a 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -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);