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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 libmpathutil/util.h      | 8 ++++----
 libmultipath/discovery.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

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);
 
-- 
2.47.0





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux