hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/proc_namespace.c
....@@ -37,23 +37,23 @@
3737 return res;
3838 }
3939
40
-struct proc_fs_info {
40
+struct proc_fs_opts {
4141 int flag;
4242 const char *str;
4343 };
4444
4545 static int show_sb_opts(struct seq_file *m, struct super_block *sb)
4646 {
47
- static const struct proc_fs_info fs_info[] = {
47
+ static const struct proc_fs_opts fs_opts[] = {
4848 { SB_SYNCHRONOUS, ",sync" },
4949 { SB_DIRSYNC, ",dirsync" },
5050 { SB_MANDLOCK, ",mand" },
5151 { SB_LAZYTIME, ",lazytime" },
5252 { 0, NULL }
5353 };
54
- const struct proc_fs_info *fs_infop;
54
+ const struct proc_fs_opts *fs_infop;
5555
56
- for (fs_infop = fs_info; fs_infop->flag; fs_infop++) {
56
+ for (fs_infop = fs_opts; fs_infop->flag; fs_infop++) {
5757 if (sb->s_flags & fs_infop->flag)
5858 seq_puts(m, fs_infop->str);
5959 }
....@@ -63,18 +63,19 @@
6363
6464 static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt)
6565 {
66
- static const struct proc_fs_info mnt_info[] = {
66
+ static const struct proc_fs_opts mnt_opts[] = {
6767 { MNT_NOSUID, ",nosuid" },
6868 { MNT_NODEV, ",nodev" },
6969 { MNT_NOEXEC, ",noexec" },
7070 { MNT_NOATIME, ",noatime" },
7171 { MNT_NODIRATIME, ",nodiratime" },
7272 { MNT_RELATIME, ",relatime" },
73
+ { MNT_NOSYMFOLLOW, ",nosymfollow" },
7374 { 0, NULL }
7475 };
75
- const struct proc_fs_info *fs_infop;
76
+ const struct proc_fs_opts *fs_infop;
7677
77
- for (fs_infop = mnt_info; fs_infop->flag; fs_infop++) {
78
+ for (fs_infop = mnt_opts; fs_infop->flag; fs_infop++) {
7879 if (mnt->mnt_flags & fs_infop->flag)
7980 seq_puts(m, fs_infop->str);
8081 }
....@@ -88,7 +89,7 @@
8889 static void show_type(struct seq_file *m, struct super_block *sb)
8990 {
9091 mangle(m, sb->s_type->name);
91
- if (sb->s_subtype && sb->s_subtype[0]) {
92
+ if (sb->s_subtype) {
9293 seq_putc(m, '.');
9394 mangle(m, sb->s_subtype);
9495 }
....@@ -121,9 +122,7 @@
121122 if (err)
122123 goto out;
123124 show_mnt_opts(m, mnt);
124
- if (sb->s_op->show_options2)
125
- err = sb->s_op->show_options2(mnt, m, mnt_path.dentry);
126
- else if (sb->s_op->show_options)
125
+ if (sb->s_op->show_options)
127126 err = sb->s_op->show_options(m, mnt_path.dentry);
128127 seq_puts(m, " 0 0\n");
129128 out:
....@@ -185,9 +184,7 @@
185184 err = show_sb_opts(m, sb);
186185 if (err)
187186 goto out;
188
- if (sb->s_op->show_options2) {
189
- err = sb->s_op->show_options2(mnt, m, mnt->mnt_root);
190
- } else if (sb->s_op->show_options)
187
+ if (sb->s_op->show_options)
191188 err = sb->s_op->show_options(m, mnt->mnt_root);
192189 seq_putc(m, '\n');
193190 out:
....@@ -283,7 +280,8 @@
283280 p->ns = ns;
284281 p->root = root;
285282 p->show = show;
286
- p->cached_event = ~0ULL;
283
+ INIT_LIST_HEAD(&p->cursor.mnt_list);
284
+ p->cursor.mnt.mnt_flags = MNT_CURSOR;
287285
288286 return 0;
289287
....@@ -300,6 +298,7 @@
300298 struct seq_file *m = file->private_data;
301299 struct proc_mounts *p = m->private;
302300 path_put(&p->root);
301
+ mnt_cursor_del(p->ns, &p->cursor);
303302 put_mnt_ns(p->ns);
304303 return seq_release_private(inode, file);
305304 }
....@@ -321,7 +320,8 @@
321320
322321 const struct file_operations proc_mounts_operations = {
323322 .open = mounts_open,
324
- .read = seq_read,
323
+ .read_iter = seq_read_iter,
324
+ .splice_read = generic_file_splice_read,
325325 .llseek = seq_lseek,
326326 .release = mounts_release,
327327 .poll = mounts_poll,
....@@ -329,7 +329,8 @@
329329
330330 const struct file_operations proc_mountinfo_operations = {
331331 .open = mountinfo_open,
332
- .read = seq_read,
332
+ .read_iter = seq_read_iter,
333
+ .splice_read = generic_file_splice_read,
333334 .llseek = seq_lseek,
334335 .release = mounts_release,
335336 .poll = mounts_poll,
....@@ -337,7 +338,8 @@
337338
338339 const struct file_operations proc_mountstats_operations = {
339340 .open = mountstats_open,
340
- .read = seq_read,
341
+ .read_iter = seq_read_iter,
342
+ .splice_read = generic_file_splice_read,
341343 .llseek = seq_lseek,
342344 .release = mounts_release,
343345 };