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

Petr Vorel pvorel@suse.cz
Tue Sep 6 17:54:49 CEST 2022


> On Tue, Sep 6, 2022 at 12:26 PM Petr Vorel <pvorel@suse.cz> 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>

> Nice cleanup.
> You may add
> Reviewed-by: Amir Goldstein <amir73il@gmail.com>

Thanks a lot for your time to review.

> however...

> > ---
> >  .../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

> > -static int fanotify_fd;
> > +static int fd;


> What is this change for?
> It makes the code less readable.
> fd is quite an unspecific name for a global variable.
The motivation was: fanotify_fd is quite long and there are quite a lot of long
lines which needs to be split. I also thought that the only file descriptor in
fanotify tests does not have to have "fanotify_" prefix. But sure, No problem, I
merge it without this change.

Kind regards,
Petr

> Thanks,
> Amir.


More information about the ltp mailing list