All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Matthew Bobrowski <repnop@google.com>, linux-fsdevel@vger.kernel.org
Subject: [PATCH v3 12/16] fanotify: create helper fanotify_mark_user_flags()
Date: Wed, 13 Apr 2022 12:09:31 +0300	[thread overview]
Message-ID: <20220413090935.3127107-13-amir73il@gmail.com> (raw)
In-Reply-To: <20220413090935.3127107-1-amir73il@gmail.com>

To translate from fsnotify mark flags to user visible flags.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/notify/fanotify/fanotify.h | 10 ++++++++++
 fs/notify/fdinfo.c            |  6 ++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h
index a3d5b751cac5..87142bc0131a 100644
--- a/fs/notify/fanotify/fanotify.h
+++ b/fs/notify/fanotify/fanotify.h
@@ -490,3 +490,13 @@ static inline unsigned int fanotify_event_hash_bucket(
 {
 	return event->hash & FANOTIFY_HTABLE_MASK;
 }
+
+static inline unsigned int fanotify_mark_user_flags(struct fsnotify_mark *mark)
+{
+	unsigned int mflags = 0;
+
+	if (mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY)
+		mflags |= FAN_MARK_IGNORED_SURV_MODIFY;
+
+	return mflags;
+}
diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c
index 1f34c5c29fdb..59fb40abe33d 100644
--- a/fs/notify/fdinfo.c
+++ b/fs/notify/fdinfo.c
@@ -14,6 +14,7 @@
 #include <linux/exportfs.h>
 
 #include "inotify/inotify.h"
+#include "fanotify/fanotify.h"
 #include "fdinfo.h"
 #include "fsnotify.h"
 
@@ -103,12 +104,9 @@ void inotify_show_fdinfo(struct seq_file *m, struct file *f)
 
 static void fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
 {
-	unsigned int mflags = 0;
+	unsigned int mflags = fanotify_mark_user_flags(mark);
 	struct inode *inode;
 
-	if (mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY)
-		mflags |= FAN_MARK_IGNORED_SURV_MODIFY;
-
 	if (mark->connector->type == FSNOTIFY_OBJ_TYPE_INODE) {
 		inode = igrab(fsnotify_conn_inode(mark->connector));
 		if (!inode)
-- 
2.35.1


  parent reply	other threads:[~2022-04-13  9:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13  9:09 [PATCH v3 00/16] Evictable fanotify marks Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 01/16] inotify: show inotify mask flags in proc fdinfo Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 02/16] inotify: move control flags from mask to mark flags Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 03/16] fsnotify: fix wrong lockdep annotations Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 04/16] fsnotify: pass flags argument to fsnotify_add_mark() via mark Amir Goldstein
2022-04-21 14:18   ` Jan Kara
2022-04-22 10:02     ` Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 05/16] fsnotify: pass flags argument to fsnotify_alloc_group() Amir Goldstein
2022-04-21 14:34   ` Jan Kara
2022-04-13  9:09 ` [PATCH v3 06/16] fsnotify: create helpers for group mark_mutex lock Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 07/16] inotify: use fsnotify group lock helpers Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 08/16] audit: " Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 09/16] nfsd: " Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 10/16] dnotify: " Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 11/16] fsnotify: allow adding an inode mark without pinning inode Amir Goldstein
2022-04-21 14:54   ` Jan Kara
2022-04-13  9:09 ` Amir Goldstein [this message]
2022-04-13  9:09 ` [PATCH v3 13/16] fanotify: factor out helper fanotify_mark_update_flags() Amir Goldstein
2022-04-21 15:00   ` Jan Kara
2022-04-13  9:09 ` [PATCH v3 14/16] fanotify: implement "evictable" inode marks Amir Goldstein
2022-04-21 15:40   ` Jan Kara
2022-04-22 10:47     ` Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 15/16] fanotify: use fsnotify group lock helpers Amir Goldstein
2022-04-13  9:09 ` [PATCH v3 16/16] fanotify: enable "evictable" inode marks Amir Goldstein
2022-04-21 15:41 ` [PATCH v3 00/16] Evictable fanotify marks Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220413090935.3127107-13-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=repnop@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.