From bf02784428c1e61e8b227c0e565992bfae36d301 Mon Sep 17 00:00:00 2001 From: Petr Vorel Date: Tue, 12 Nov 2019 23:18:32 +0100 Subject: [PATCH 2/3] fanotify: Rework checks for fallback definitions Add autoconf checks for struct fanotify_event_info_fid and struct fanotify_event_info_header. Instead of detecting via FAN_REPORT_FID or HAVE_NAME_TO_HANDLE_AT. Acked-by: Cyril Hrubis Acked-by: Jan Stancek Signed-off-by: Petr Vorel [Upstream status: bf02784428c1e61e8b227c0e565992bfae36d301] --- configure.ac | 1 + m4/ltp-fanotify.m4 | 7 +++++++ testcases/kernel/syscalls/fanotify/fanotify.h | 14 ++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 m4/ltp-fanotify.m4 diff --git a/configure.ac b/configure.ac index 3785dff63..b762e83c2 100644 --- a/configure.ac +++ b/configure.ac @@ -213,6 +213,7 @@ LTP_CHECK_CAPABILITY_SUPPORT LTP_CHECK_CC_WARN_OLDSTYLE LTP_CHECK_CLONE_SUPPORTS_7_ARGS LTP_CHECK_CRYPTO +LTP_CHECK_FANOTIFY LTP_CHECK_FIDEDUPE LTP_CHECK_FORTIFY_SOURCE LTP_CHECK_FTS_H diff --git a/m4/ltp-fanotify.m4 b/m4/ltp-fanotify.m4 new file mode 100644 index 000000000..e7b77d8a4 --- /dev/null +++ b/m4/ltp-fanotify.m4 @@ -0,0 +1,7 @@ +dnl SPDX-License-Identifier: GPL-2.0-or-later +dnl Copyright (c) 2019 Petr Vorel + +AC_DEFUN([LTP_CHECK_FANOTIFY],[ +AC_CHECK_TYPES([struct fanotify_event_info_header],,,[#include ]) +AC_CHECK_TYPES([struct fanotify_event_info_fid],,,[#include ]) +]) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 573ed5f59..9d2fded13 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -101,6 +101,10 @@ static long fanotify_mark(int fd, unsigned int flags, uint64_t mask, #define FAN_OPEN_EXEC_PERM 0x00040000 #endif +#ifndef FAN_REPORT_FID +#define FAN_REPORT_FID 0x00000200 +#endif + /* * FAN_ALL_PERM_EVENTS has been deprecated, so any new permission events * are not to be added to it. To cover the instance where a new permission @@ -123,23 +127,21 @@ typedef struct { #define __kernel_fsid_t lapi_fsid_t #endif /* __kernel_fsid_t */ -#ifndef FAN_REPORT_FID -#define FAN_REPORT_FID 0x00000200 - +#ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER struct fanotify_event_info_header { uint8_t info_type; uint8_t pad; uint16_t len; }; +#endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER */ -#ifdef HAVE_NAME_TO_HANDLE_AT +#ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID struct fanotify_event_info_fid { struct fanotify_event_info_header hdr; __kernel_fsid_t fsid; unsigned char handle[0]; }; -#endif /* HAVE_NAME_TO_HANDLE_AT */ -#endif /* ! FAN_REPORT_FID */ +#endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID */ #ifdef HAVE_NAME_TO_HANDLE_AT /* -- 2.24.0