hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/notify/fdinfo.c
....@@ -11,10 +11,10 @@
1111 #include <linux/sched.h>
1212 #include <linux/types.h>
1313 #include <linux/seq_file.h>
14
-#include <linux/proc_fs.h>
1514 #include <linux/exportfs.h>
1615
1716 #include "inotify/inotify.h"
17
+#include "fdinfo.h"
1818 #include "fsnotify.h"
1919
2020 #if defined(CONFIG_PROC_FS)
....@@ -49,7 +49,7 @@
4949 f.handle.handle_bytes = sizeof(f.pad);
5050 size = f.handle.handle_bytes >> 2;
5151
52
- ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, 0);
52
+ ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, NULL);
5353 if ((ret == FILEID_INVALID) || (ret < 0)) {
5454 WARN_ONCE(1, "Can't encode file handler for inotify: %d\n", ret);
5555 return;
....@@ -83,16 +83,9 @@
8383 inode_mark = container_of(mark, struct inotify_inode_mark, fsn_mark);
8484 inode = igrab(fsnotify_conn_inode(mark->connector));
8585 if (inode) {
86
- /*
87
- * IN_ALL_EVENTS represents all of the mask bits
88
- * that we expose to userspace. There is at
89
- * least one bit (FS_EVENT_ON_CHILD) which is
90
- * used only internally to the kernel.
91
- */
92
- u32 mask = mark->mask & IN_ALL_EVENTS;
93
- seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:%x ",
86
+ seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:0 ",
9487 inode_mark->wd, inode->i_ino, inode->i_sb->s_dev,
95
- mask, mark->ignored_mask);
88
+ inotify_mark_user_mask(mark));
9689 show_mark_fhandle(m, inode);
9790 seq_putc(m, '\n');
9891 iput(inode);
....@@ -131,37 +124,20 @@
131124
132125 seq_printf(m, "fanotify mnt_id:%x mflags:%x mask:%x ignored_mask:%x\n",
133126 mnt->mnt_id, mflags, mark->mask, mark->ignored_mask);
127
+ } else if (mark->connector->type == FSNOTIFY_OBJ_TYPE_SB) {
128
+ struct super_block *sb = fsnotify_conn_sb(mark->connector);
129
+
130
+ seq_printf(m, "fanotify sdev:%x mflags:%x mask:%x ignored_mask:%x\n",
131
+ sb->s_dev, mflags, mark->mask, mark->ignored_mask);
134132 }
135133 }
136134
137135 void fanotify_show_fdinfo(struct seq_file *m, struct file *f)
138136 {
139137 struct fsnotify_group *group = f->private_data;
140
- unsigned int flags = 0;
141
-
142
- switch (group->priority) {
143
- case FS_PRIO_0:
144
- flags |= FAN_CLASS_NOTIF;
145
- break;
146
- case FS_PRIO_1:
147
- flags |= FAN_CLASS_CONTENT;
148
- break;
149
- case FS_PRIO_2:
150
- flags |= FAN_CLASS_PRE_CONTENT;
151
- break;
152
- }
153
-
154
- if (group->max_events == UINT_MAX)
155
- flags |= FAN_UNLIMITED_QUEUE;
156
-
157
- if (group->fanotify_data.max_marks == UINT_MAX)
158
- flags |= FAN_UNLIMITED_MARKS;
159
-
160
- if (group->fanotify_data.audit)
161
- flags |= FAN_ENABLE_AUDIT;
162138
163139 seq_printf(m, "fanotify flags:%x event-flags:%x\n",
164
- flags, group->fanotify_data.f_flags);
140
+ group->fanotify_data.flags, group->fanotify_data.f_flags);
165141
166142 show_fdinfo(m, f, fanotify_fdinfo);
167143 }