[LTP] [PATCH 5/6] fanotify: Convert remaining init_flags tests to be performed on target fs

Amir Goldstein amir73il@gmail.com
Wed Nov 29 15:53:43 CET 2023


On Wed, Nov 29, 2023 at 1:54 PM Jan Kara <jack@suse.cz> wrote:
>
> Convert remaining tests using
> REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_BY_KERNEL to be performed on
> target filesystem using REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS and
> remove the now unused macro and functions.
>
> Signed-off-by: Jan Kara <jack@suse.cz>

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

> ---
>  testcases/kernel/syscalls/fanotify/fanotify.h   | 9 ---------
>  testcases/kernel/syscalls/fanotify/fanotify20.c | 3 ++-
>  testcases/kernel/syscalls/fanotify/fanotify21.c | 3 ++-
>  3 files changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
> index e02ea8c24dcb..052b29a7cedc 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify.h
> +++ b/testcases/kernel/syscalls/fanotify/fanotify.h
> @@ -198,11 +198,6 @@ static inline int fanotify_init_flags_supported_on_fs(unsigned int flags, const
>         return fanotify_flags_supported_on_fs(flags, FAN_MARK_INODE, FAN_ACCESS, fname);
>  }
>
> -static inline int fanotify_init_flags_supported_by_kernel(unsigned int flags)
> -{
> -       return fanotify_init_flags_supported_on_fs(flags, NULL);
> -}
> -
>  static inline int fanotify_mark_supported_on_fs(uint64_t flag, const char *fname)
>  {
>         return fanotify_flags_supported_on_fs(FAN_CLASS_CONTENT, flag, FAN_ACCESS, fname);
> @@ -277,10 +272,6 @@ static inline void fanotify_flags_err_msg(const char *flags_str,
>         fanotify_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \
>                 fanotify_init_flags_supported_on_fs(flags, fname))
>
> -#define REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_BY_KERNEL(flags) \
> -       fanotify_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \
> -               fanotify_init_flags_supported_by_kernel(flags))
> -
>  static inline int fanotify_handle_supported_by_kernel(int flag)
>  {
>         /*
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify20.c b/testcases/kernel/syscalls/fanotify/fanotify20.c
> index 71310fb86e9e..1d249ac9cfcc 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify20.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify20.c
> @@ -50,7 +50,8 @@ static void do_setup(void)
>          * An explicit check for FAN_REPORT_PIDFD is performed early on in the
>          * test initialization as it's a prerequisite for all test cases.
>          */
> -       REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_BY_KERNEL(FAN_REPORT_PIDFD);
> +       REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_PIDFD,
> +                                                   MOUNT_PATH);
>  }
>
>  static void do_test(unsigned int i)
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify21.c b/testcases/kernel/syscalls/fanotify/fanotify21.c
> index 8a1028086237..d54930f05161 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify21.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify21.c
> @@ -119,7 +119,8 @@ static void do_setup(void)
>          * on in the test initialization as it's a prerequisite for
>          * all test cases.
>          */
> -       REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_BY_KERNEL(FAN_REPORT_PIDFD);
> +       REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_PIDFD,
> +                                                   TEST_FILE);
>
>         fanotify_fd = SAFE_FANOTIFY_INIT(FAN_REPORT_PIDFD, O_RDONLY);
>         SAFE_FANOTIFY_MARK(fanotify_fd, FAN_MARK_ADD, FAN_OPEN, AT_FDCWD,
> --
> 2.35.3
>


More information about the ltp mailing list