[LTP] [PATCH v3 1/3] syscalls/fanotify: Add a helper macro which checks for the presence of specific fanotify initialization flag(s)

Matthew Bobrowski repnop@google.com
Tue Nov 9 11:04:51 CET 2021


This is a trivial macro that can be used throughout fanotify tests to
check whether the underlying running kernel supports the supplied
fanotify initialization flag(s).

Signed-off-by: Matthew Bobrowski <repnop@google.com>
---
 testcases/kernel/syscalls/fanotify/fanotify.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index a2be18338..e2db3c6f5 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -352,6 +352,11 @@ static inline void fanotify_init_flags_err_msg(const char *flags_str,
 		fanotify_init_flags_supported_on_fs(flags, fname)); \
 	} while (0)
 
+#define REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_BY_KERNEL(flags) do { \
+	fanotify_init_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \
+		fanotify_init_flags_supported_by_kernel(flags)); \
+	} while (0)
+
 static inline int fanotify_mark_supported_by_kernel(uint64_t flag)
 {
 	int fd;
-- 
2.34.0.rc0.344.g81b53c2807-goog

/M


More information about the ltp mailing list