Skip to content

Commit

Permalink
selftests/vm: remove ARRAY_SIZE define from individual tests
Browse files Browse the repository at this point in the history
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.

Remove ARRAY_SIZE from vm tests and pickup the one defined in
kselftest.h.

Signed-off-by: Shuah Khan <[email protected]>
  • Loading branch information
shuahkh committed Dec 11, 2021
1 parent 7527c03 commit e899082
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion tools/testing/selftests/vm/mremap_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#define VALIDATION_DEFAULT_THRESHOLD 4 /* 4MB */
#define VALIDATION_NO_THRESHOLD 0 /* Verify the entire region */

#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))

struct config {
Expand Down
3 changes: 2 additions & 1 deletion tools/testing/selftests/vm/pkey-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <ucontext.h>
#include <sys/mman.h>

#include "../kselftest.h"

/* Define some kernel-like types */
#define u8 __u8
#define u16 __u16
Expand Down Expand Up @@ -175,7 +177,6 @@ static inline void __pkey_write_allow(int pkey, int do_allow_write)
dprintf4("pkey_reg now: %016llx\n", read_pkey_reg());
}

#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
#define ALIGN_UP(x, align_to) (((x) + ((align_to)-1)) & ~((align_to)-1))
#define ALIGN_DOWN(x, align_to) ((x) & ~((align_to)-1))
#define ALIGN_PTR_UP(p, ptr_align_to) \
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/vm/va_128TBswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <sys/mman.h>
#include <string.h>

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#include "../kselftest.h"

#ifdef __powerpc64__
#define PAGE_SIZE (64 << 10)
Expand Down

0 comments on commit e899082

Please sign in to comment.