[LTP] [PATCH 2/3] fanotify20: Simplify code

Matthew Bobrowski repnop@google.com
Wed Sep 7 09:05:33 CEST 2022


On Tue, Sep 06, 2022 at 11:26:14AM +0200, Petr Vorel wrote:
> * replace do_test() content with TST_EXP_FD_ERRNO() macro
> * rename variables (shorten, use LTP common names)
> * remove tc->want_err (not needed)
> * add macro FLAGS_DESC (stringify)
> * don't print number of tests (not needed for just 2 tests)
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>

Awesome simplification!

Reviewed-by: Matthew Bobrowski <repnop@google.com>

> ---
>  .../kernel/syscalls/fanotify/fanotify20.c     | 81 +++++--------------
>  1 file changed, 19 insertions(+), 62 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify20.c b/testcases/kernel/syscalls/fanotify/fanotify20.c
> index de0fdb782..badc4c369 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify20.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify20.c
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later
>  /*
>   * Copyright (c) 2021 Google. All Rights Reserved.
> + * Copyright (c) 2022 Petr Vorel <pvorel@suse.cz>
>   *
>   * Started by Matthew Bobrowski <repnop@google.com>
>   */
> @@ -25,26 +26,21 @@
>  #include "fanotify.h"
>  
>  #define MOUNT_PATH	"fs_mnt"
> +#define FLAGS_DESC(x) .flags = x, .desc = #x

I'm wondering whether it makes sense to move this out into fanotify.h,
so that if the same test approach is ever used, we can simply recycle
this macro definition.

/M


More information about the ltp mailing list