syscalls/fanotify: fix build errors on centos 6
PATCH 1/1 syscalls/fanotify: fix build errors on centos 6
Do not try to build fanotify1[35] and helpers when system does not support name_to_handle_at().
Signed-off-by Amir Goldstein <[email protected]>
---
Petr,
This patch is on top of Matthew's series.
Please see if it fixed build errors you reported in centos 6.
Thanks,
Amir.
testcases/kernel/syscalls/fanotify/fanotify.h | 16 +++++++--------- testcases/kernel/syscalls/fanotify/fanotify13.c | 4 ++++ testcases/kernel/syscalls/fanotify/fanotify15.c | 4 ++++ 3 files changed, 15 insertions(+), 9 deletions(-)
testcases/kernel/syscalls/fanotify/fanotify.h +7 -9
@@ -125,21 +125,22 @@ struct fanotify_event_info_header {uint16_t len; }; +#ifdef HAVE_NAME_TO_HANDLE_AT struct fanotify_event_info_fid {struct fanotify_event_info_header hdr;__kernel_fsid_t fsid;unsigned char handle[0 ]; }; - +#endif #endif +#ifdef HAVE_NAME_TO_HANDLE_AT /* -* Helper function used to obtain __kernel_fsid_t and file_handle objects -* for a given path. Used by test files correlated to FAN_REPORT_FID -* functionality. +* Helper function used to obtain fsid and file_handle for a given path. +* Used by test files correlated to FAN_REPORT_FID functionality. */ static inline void fanotify_get_fid (const char *path,__kernel_fsid_t *fsid, -struct file_handle *handle) +struct file_handle *handle) {int mount_id;struct statfs stats;
@@ -149,7 +150,6 @@ static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid, "statfs(%s, ...) failed", path);memcpy (fsid, &stats.f_fsid,sizeof (stats.f_fsid)); -#ifdef HAVE_NAME_TO_HANDLE_AT if (name_to_handle_at (AT_FDCWD , path, handle, &mount_id,0 ) ==-1 ) {if (errno ==EOPNOTSUPP ) { tst_brk(TCONF,
@@ -159,10 +159,8 @@ static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid,tst_brk (TBROK |TERRNO , "name_to_handle_at(AT_FDCWD, %s, ...) failed", path); } -#else -tst_brk (TCONF ,"name_to_handle_at() is not implmented" ); -#endif /* HAVE_NAME_TO_HANDLE_AT */ } +#endif /* HAVE_NAME_TO_HANDLE_AT */ #define INIT_FANOTIFY_MARK_TYPE (t) \ { FAN_MARK_ ## t, "FAN_MARK_" #t }
testcases/kernel/syscalls/fanotify/fanotify13.c +4 -0
@@ -38,6 +38,7 @@#define FILE_PATH_ONE MOUNT_PATH"/"FILE_ONE#define FILE_PATH_TWO MOUNT_PATH"/"FILE_TWO +#if defined(HAVE_NAME_TO_HANDLE_AT) struct event_t { unsigned long long expected_mask; __kernel_fsid_t fsid;
@@ -323,6 +324,9 @@ static struct tst_test test = { .all_filesystems = 1 }; +#else +TST_TEST_TCONF ("System does not have required name_to_handle_at() support" ); +#endif #else TST_TEST_TCONF ("System does not have required fanotify support" );#endif
testcases/kernel/syscalls/fanotify/fanotify15.c +4 -0
@@ -35,6 +35,7 @@#define FILE1 TEST_DIR"/file1"#define FILE2 TEST_DIR"/file2" +#if defined(HAVE_NAME_TO_HANDLE_AT) struct event_t { unsigned long long mask; __kernel_fsid_t fsid;
@@ -241,6 +242,9 @@ static struct tst_test test = { .cleanup = do_cleanup }; +#else +TST_TEST_TCONF ("System does not have required name_to_handle_at() support" ); +#endif #else TST_TEST_TCONF ("System does not have required fanotify support" );#endif
Signature · 1 line
2.17.1
PATCH 1/1 syscalls/fanotify: fix build errors on centos 6
Hi!
This seems to work, so I applied it on the top of the patchset from Matthew, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]