@@ -5,6 +5,7 @@
*/
#define _GNU_SOURCE
+#include <linux/kernel.h>
#include <fcntl.h>
#include <sched.h>
#include <sys/stat.h>
@@ -82,14 +83,14 @@ void test_openat2_struct(void)
.size = sizeof(struct open_how_ext), .err = -E2BIG },
};
- BUILD_BUG_ON(ARRAY_LEN(misalignments) != NUM_OPENAT2_STRUCT_VARIATIONS);
- BUILD_BUG_ON(ARRAY_LEN(tests) != NUM_OPENAT2_STRUCT_TESTS);
+ BUILD_BUG_ON(ARRAY_SIZE(misalignments) != NUM_OPENAT2_STRUCT_VARIATIONS);
+ BUILD_BUG_ON(ARRAY_SIZE(tests) != NUM_OPENAT2_STRUCT_TESTS);
- for (int i = 0; i < ARRAY_LEN(tests); i++) {
+ for (int i = 0; i < ARRAY_SIZE(tests); i++) {
struct struct_test *test = &tests[i];
struct open_how_ext how_ext = test->arg;
- for (int j = 0; j < ARRAY_LEN(misalignments); j++) {
+ for (int j = 0; j < ARRAY_SIZE(misalignments); j++) {
int fd, misalign = misalignments[j];
char *fdpath = NULL;
bool failed;
@@ -240,9 +241,9 @@ void test_openat2_flags(void)
.how.resolve = 0, .err = -EINVAL },
};
- BUILD_BUG_ON(ARRAY_LEN(tests) != NUM_OPENAT2_FLAG_TESTS);
+ BUILD_BUG_ON(ARRAY_SIZE(tests) != NUM_OPENAT2_FLAG_TESTS);
- for (int i = 0; i < ARRAY_LEN(tests); i++) {
+ for (int i = 0; i < ARRAY_SIZE(tests); i++) {
int fd, fdflags = -1;
char *path, *fdpath = NULL;
bool failed = false;