Re: [PATCH v8 24/32] fanotify: Add helpers to decide whether to report FID/DFID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 19, 2021 at 3:03 AM Gabriel Krisman Bertazi
<krisman@xxxxxxxxxxxxx> wrote:
>
> Now that there is an event that reports FID records even for a zeroed
> file handle, wrap the logic that deides whether to issue the records
> into helper functions.  This shouldn't have any impact on the code, but
> simplifies further patches.
>
> Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxxxxxxxx>
> ---
>  fs/notify/fanotify/fanotify.h      | 13 +++++++++++++
>  fs/notify/fanotify/fanotify_user.c | 13 +++++++------
>  2 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h
> index a5e81d759f65..bdf01ad4f9bf 100644
> --- a/fs/notify/fanotify/fanotify.h
> +++ b/fs/notify/fanotify/fanotify.h
> @@ -265,6 +265,19 @@ static inline int fanotify_event_dir_fh_len(struct fanotify_event *event)
>         return info ? fanotify_info_dir_fh_len(info) : 0;
>  }
>
> +static inline bool fanotify_event_has_object_fh(struct fanotify_event *event)
> +{
> +       if (fanotify_event_object_fh_len(event) > 0)
> +               return true;
> +
> +       return false;

Sorry, this construct gives me a rush ;)
What's wrong with

return fanotify_event_object_fh_len(event) > 0;

> +}
> +
> +static inline bool fanotify_event_has_dir_fh(struct fanotify_event *event)
> +{
> +       return (fanotify_event_dir_fh_len(event) > 0) ? true : false;
> +}

Likewise, except '(cond) ? true : false' gives me an even more
irritating rush...

Thanks,
Amir.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux