Whamcloud - gitweb
LU-9897 utils: have lfs.c use lstddef.h 21/38921/4
authorJames Simmons <jsimmons@infradead.org>
Fri, 12 Jun 2020 18:12:38 +0000 (14:12 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 19 Jun 2020 16:51:21 +0000 (16:51 +0000)
Instead of redefining ARRAY_SIZE in lfs.c we can use the macros
in lstddef.h

Test-Parameters: trivial
Change-Id: I33bca9773b609f1996ea66098edb67426273f801
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/38921
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
lustre/utils/lfs.c
lustre/utils/lstddef.h

index 1753019..1bef5bf 100644 (file)
 #include <linux/lustre/lustre_param.h>
 #include <linux/lnet/nidstr.h>
 #include <lnetconfig/cyaml.h>
 #include <linux/lustre/lustre_param.h>
 #include <linux/lnet/nidstr.h>
 #include <lnetconfig/cyaml.h>
-
-#ifndef ARRAY_SIZE
-# define ARRAY_SIZE(a) ((sizeof(a)) / (sizeof((a)[0])))
-#endif /* !ARRAY_SIZE */
+#include "lstddef.h"
 
 /* all functions */
 static int lfs_find(int argc, char **argv);
 
 /* all functions */
 static int lfs_find(int argc, char **argv);
index f1a6431..7b785a7 100644 (file)
@@ -1,7 +1,8 @@
 #ifndef _LSTDDEF_H
 #define _LSTDDEF_H
 
 #ifndef _LSTDDEF_H
 #define _LSTDDEF_H
 
-#include <stddef.h>
+#include <linux/types.h>
+#include <sys/param.h>
 
 #define __ALIGN_LSTDDEF_MASK(x, mask) (((x) + (mask)) & ~(mask))
 #define __ALIGN_LSTDDEF(x, a) __ALIGN_LSTDDEF_MASK(x, (typeof(x))(a) - 1)
 
 #define __ALIGN_LSTDDEF_MASK(x, mask) (((x) + (mask)) & ~(mask))
 #define __ALIGN_LSTDDEF(x, a) __ALIGN_LSTDDEF_MASK(x, (typeof(x))(a) - 1)
 # define DIV_ROUND_UP_SECTOR_T(ll, d) DIV_ROUND_UP(ll, d)
 #endif
 
 # define DIV_ROUND_UP_SECTOR_T(ll, d) DIV_ROUND_UP(ll, d)
 #endif
 
-/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
-#define roundup(x, y) ({                               \
-       const typeof(y) __y = y;                        \
-       (((x) + (__y - 1)) / __y) * __y;                \
-})
-
 #define rounddown(x, y) ({                             \
        typeof(x) __x = (x);                            \
        __x - (__x % (y));                              \
 #define rounddown(x, y) ({                             \
        typeof(x) __x = (x);                            \
        __x - (__x % (y));                              \