[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ4uxha3CVzMTnvh70vXCVg8zeoS1vkQYuS2GwgqGXxzYWTRw@mail.gmail.com>
Date: Tue, 19 Oct 2021 09:12:34 +0300
From: Amir Goldstein <amir73il@...il.com>
To: Gabriel Krisman Bertazi <krisman@...labora.com>
Cc: Jan Kara <jack@...e.com>, "Darrick J. Wong" <djwong@...nel.org>,
Theodore Tso <tytso@....edu>,
Dave Chinner <david@...morbit.com>,
David Howells <dhowells@...hat.com>,
Khazhismel Kumykov <khazhy@...gle.com>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Ext4 <linux-ext4@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>, kernel@...labora.com
Subject: Re: [PATCH v8 24/32] fanotify: Add helpers to decide whether to
report FID/DFID
On Tue, Oct 19, 2021 at 3:03 AM Gabriel Krisman Bertazi
<krisman@...labora.com> 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@...labora.com>
> ---
> 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.
Powered by blists - more mailing lists