From b12c5467366f1ce66bf8fe9973803414c947c322 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Fri, 12 Jun 2020 14:12:38 -0400 Subject: [PATCH] LU-9897 utils: have lfs.c use lstddef.h 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 Reviewed-on: https://review.whamcloud.com/38921 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Emoly Liu --- lustre/utils/lfs.c | 5 +---- lustre/utils/lstddef.h | 9 ++------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 1753019..1bef5bf 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -77,10 +77,7 @@ #include #include #include - -#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); diff --git a/lustre/utils/lstddef.h b/lustre/utils/lstddef.h index f1a6431..7b785a7 100644 --- a/lustre/utils/lstddef.h +++ b/lustre/utils/lstddef.h @@ -1,7 +1,8 @@ #ifndef _LSTDDEF_H #define _LSTDDEF_H -#include +#include +#include #define __ALIGN_LSTDDEF_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define __ALIGN_LSTDDEF(x, a) __ALIGN_LSTDDEF_MASK(x, (typeof(x))(a) - 1) @@ -43,12 +44,6 @@ # 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)); \ -- 1.8.3.1