aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/inode.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-11-01 19:07:25 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2019-02-28 03:29:27 -0500
commit60a3c3a58e2e01e19ed2b68b415adb12118ac349 (patch)
tree2535e20323f20f42922f8c87c782771aa2746313 /fs/proc/inode.c
parent0b52075ee62301dd150c9f2c3ddd0035ed894cde (diff)
procfs: Move proc_fill_super() to fs/proc/root.c
Move proc_fill_super() to fs/proc/root.c as that's where the other superblock stuff is. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Alexey Dobriyan <adobriyan@gmail.com> cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc/inode.c')
-rw-r--r--fs/proc/inode.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index da649ccd6804..17b5261206dd 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -24,7 +24,6 @@
24#include <linux/seq_file.h> 24#include <linux/seq_file.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/mount.h> 26#include <linux/mount.h>
27#include <linux/magic.h>
28 27
29#include <linux/uaccess.h> 28#include <linux/uaccess.h>
30 29
@@ -122,7 +121,7 @@ static int proc_show_options(struct seq_file *seq, struct dentry *root)
122 return 0; 121 return 0;
123} 122}
124 123
125static const struct super_operations proc_sops = { 124const struct super_operations proc_sops = {
126 .alloc_inode = proc_alloc_inode, 125 .alloc_inode = proc_alloc_inode,
127 .destroy_inode = proc_destroy_inode, 126 .destroy_inode = proc_destroy_inode,
128 .drop_inode = generic_delete_inode, 127 .drop_inode = generic_delete_inode,
@@ -488,51 +487,3 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
488 pde_put(de); 487 pde_put(de);
489 return inode; 488 return inode;
490} 489}
491
492int proc_fill_super(struct super_block *s, void *data, int silent)
493{
494 struct pid_namespace *ns = get_pid_ns(s->s_fs_info);
495 struct inode *root_inode;
496 int ret;
497
498 if (!proc_parse_options(data, ns))
499 return -EINVAL;
500
501 /* User space would break if executables or devices appear on proc */
502 s->s_iflags |= SB_I_USERNS_VISIBLE | SB_I_NOEXEC | SB_I_NODEV;
503 s->s_flags |= SB_NODIRATIME | SB_NOSUID | SB_NOEXEC;
504 s->s_blocksize = 1024;
505 s->s_blocksize_bits = 10;
506 s->s_magic = PROC_SUPER_MAGIC;
507 s->s_op = &proc_sops;
508 s->s_time_gran = 1;
509
510 /*
511 * procfs isn't actually a stacking filesystem; however, there is
512 * too much magic going on inside it to permit stacking things on
513 * top of it
514 */
515 s->s_stack_depth = FILESYSTEM_MAX_STACK_DEPTH;
516
517 /* procfs dentries and inodes don't require IO to create */
518 s->s_shrink.seeks = 0;
519
520 pde_get(&proc_root);
521 root_inode = proc_get_inode(s, &proc_root);
522 if (!root_inode) {
523 pr_err("proc_fill_super: get root inode failed\n");
524 return -ENOMEM;
525 }
526
527 s->s_root = d_make_root(root_inode);
528 if (!s->s_root) {
529 pr_err("proc_fill_super: allocate dentry failed\n");
530 return -ENOMEM;
531 }
532
533 ret = proc_setup_self(s);
534 if (ret) {
535 return ret;
536 }
537 return proc_setup_thread_self(s);
538}