Skip to content

Commit 4adce25

Browse files
amir73iljankara
authored andcommitted
fanotify: create helper fanotify_mark_user_flags()
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>
1 parent c3638b5 commit 4adce25

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

fs/notify/fanotify/fanotify.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,3 +490,13 @@ static inline unsigned int fanotify_event_hash_bucket(
490490
{
491491
return event->hash & FANOTIFY_HTABLE_MASK;
492492
}
493+
494+
static inline unsigned int fanotify_mark_user_flags(struct fsnotify_mark *mark)
495+
{
496+
unsigned int mflags = 0;
497+
498+
if (mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY)
499+
mflags |= FAN_MARK_IGNORED_SURV_MODIFY;
500+
501+
return mflags;
502+
}

fs/notify/fdinfo.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/exportfs.h>
1515

1616
#include "inotify/inotify.h"
17+
#include "fanotify/fanotify.h"
1718
#include "fdinfo.h"
1819
#include "fsnotify.h"
1920

@@ -103,12 +104,9 @@ void inotify_show_fdinfo(struct seq_file *m, struct file *f)
103104

104105
static void fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
105106
{
106-
unsigned int mflags = 0;
107+
unsigned int mflags = fanotify_mark_user_flags(mark);
107108
struct inode *inode;
108109

109-
if (mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY)
110-
mflags |= FAN_MARK_IGNORED_SURV_MODIFY;
111-
112110
if (mark->connector->type == FSNOTIFY_OBJ_TYPE_INODE) {
113111
inode = igrab(fsnotify_conn_inode(mark->connector));
114112
if (!inode)

0 commit comments

Comments
 (0)