[dm-devel] [PATCH 08/19] libmultipath: add ARRAY_SIZE helper

Martin Wilck mwilck at suse.com
Tue Dec 18 23:19:20 UTC 2018


Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 libmultipath/util.h | 1 +
 tests/hwtable.c     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/libmultipath/util.h b/libmultipath/util.h
index 1f13c913..dea3fa04 100644
--- a/libmultipath/util.h
+++ b/libmultipath/util.h
@@ -25,6 +25,7 @@ int safe_write(int fd, const void *buf, size_t count);
 void set_max_fds(int max_fds);
 
 #define KERNEL_VERSION(maj, min, ptc) ((((maj) * 256) + (min)) * 256 + (ptc))
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
 
 #define safe_sprintf(var, format, args...)	\
 	snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
diff --git a/tests/hwtable.c b/tests/hwtable.c
index 789481ff..ad863b08 100644
--- a/tests/hwtable.c
+++ b/tests/hwtable.c
@@ -24,8 +24,8 @@
 #include "pgpolicies.h"
 #include "test-lib.h"
 #include "print.h"
+#include "util.h"
 
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
 #define N_CONF_FILES 2
 
 static const char tmplate[] = "/tmp/hwtable-XXXXXX";
-- 
2.19.2




More information about the dm-devel mailing list