fanotify: create helper fanotify_mark_user_flags()
authorAmir Goldstein <amir73il@gmail.com>
Fri, 22 Apr 2022 12:03:23 +0000 (15:03 +0300)
committerJan Kara <jack@suse.cz>
Mon, 25 Apr 2022 12:43:00 +0000 (14:43 +0200)
To translate from fsnotify mark flags to user visible flags.

Link: https://lore.kernel.org/r/20220422120327.3459282-13-amir73il@gmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/notify/fanotify/fanotify.h
fs/notify/fdinfo.c

index a3d5b75..87142bc 100644 (file)
@@ -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;
+}
index 1f34c5c..59fb40a 100644 (file)
@@ -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)