summaryrefslogtreecommitdiffstats
path: root/fs/orangefs/orangefs-debug.h
diff options
context:
space:
mode:
authorJérémy Lefaure <jeremy.lefaure@lse.epita.fr>2017-10-01 15:30:48 -0400
committerMike Marshall <hubcap@omnibond.com>2017-11-13 15:09:58 -0500
commit296200d3bb649f9646f60abe6e8ebb9fd8d20f4b (patch)
treed47aaf3f3608f15a4d2f747e3bf13d82b7d5454d /fs/orangefs/orangefs-debug.h
parent933f7ac1a1df37ab6b25b50a85c13fcc5ea8cd03 (diff)
downloadlinux-296200d3bb649f9646f60abe6e8ebb9fd8d20f4b.tar.bz2
orangefs: use ARRAY_SIZE
Using the ARRAY_SIZE macro improves the readability of the code. Found with Coccinelle with the following semantic patch: @r depends on (org || report)@ type T; T[] E; position p; @@ ( (sizeof(E)@p /sizeof(*E)) | (sizeof(E)@p /sizeof(E[...])) | (sizeof(E)@p /sizeof(T)) ) Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs/orangefs-debug.h')
-rw-r--r--fs/orangefs/orangefs-debug.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/orangefs/orangefs-debug.h b/fs/orangefs/orangefs-debug.h
index b6001bb28f5a..c7db56a31b92 100644
--- a/fs/orangefs/orangefs-debug.h
+++ b/fs/orangefs/orangefs-debug.h
@@ -15,8 +15,10 @@
#ifdef __KERNEL__
#include <linux/types.h>
+#include <linux/kernel.h>
#else
#include <stdint.h>
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif
#define GOSSIP_NO_DEBUG (__u64)0
@@ -88,6 +90,6 @@ static struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
};
static const int num_kmod_keyword_mask_map = (int)
- (sizeof(s_kmod_keyword_mask_map) / sizeof(struct __keyword_mask_s));
+ (ARRAY_SIZE(s_kmod_keyword_mask_map));
#endif /* __ORANGEFS_DEBUG_H */