aboutsummaryrefslogtreecommitdiffstats
path: root/fs/kernfs/mount.c
diff options
context:
space:
mode:
authorJianyu Zhan <nasa4836@gmail.com>2014-04-26 03:40:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-03 11:11:18 -0400
commitc9482a5bdcc09be9096f40e858c5fe39c389cd52 (patch)
tree7227a6ac1cee3b5280de6dc51f37e7501af56385 /fs/kernfs/mount.c
parentcae61ba37b4c2672704cbd8a626fbd85be7e67d9 (diff)
kernfs: move the last knowledge of sysfs out from kernfs
There is still one residue of sysfs remaining: the sb_magic SYSFS_MAGIC. However this should be kernfs user specific, so this patch moves it out. Kerrnfs user should specify their magic number while mouting. Signed-off-by: Jianyu Zhan <nasa4836@gmail.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/kernfs/mount.c')
-rw-r--r--fs/kernfs/mount.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index 6a5f04ac8704..95dcd1d558bb 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
@@ -62,7 +62,7 @@ struct kernfs_root *kernfs_root_from_sb(struct super_block *sb)
62 return NULL; 62 return NULL;
63} 63}
64 64
65static int kernfs_fill_super(struct super_block *sb) 65static int kernfs_fill_super(struct super_block *sb, unsigned long magic)
66{ 66{
67 struct kernfs_super_info *info = kernfs_info(sb); 67 struct kernfs_super_info *info = kernfs_info(sb);
68 struct inode *inode; 68 struct inode *inode;
@@ -70,7 +70,7 @@ static int kernfs_fill_super(struct super_block *sb)
70 70
71 sb->s_blocksize = PAGE_CACHE_SIZE; 71 sb->s_blocksize = PAGE_CACHE_SIZE;
72 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 72 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
73 sb->s_magic = SYSFS_MAGIC; 73 sb->s_magic = magic;
74 sb->s_op = &kernfs_sops; 74 sb->s_op = &kernfs_sops;
75 sb->s_time_gran = 1; 75 sb->s_time_gran = 1;
76 76
@@ -131,6 +131,7 @@ const void *kernfs_super_ns(struct super_block *sb)
131 * @fs_type: file_system_type of the fs being mounted 131 * @fs_type: file_system_type of the fs being mounted
132 * @flags: mount flags specified for the mount 132 * @flags: mount flags specified for the mount
133 * @root: kernfs_root of the hierarchy being mounted 133 * @root: kernfs_root of the hierarchy being mounted
134 * @magic: file system specific magic number
134 * @new_sb_created: tell the caller if we allocated a new superblock 135 * @new_sb_created: tell the caller if we allocated a new superblock
135 * @ns: optional namespace tag of the mount 136 * @ns: optional namespace tag of the mount
136 * 137 *
@@ -142,8 +143,8 @@ const void *kernfs_super_ns(struct super_block *sb)
142 * The return value can be passed to the vfs layer verbatim. 143 * The return value can be passed to the vfs layer verbatim.
143 */ 144 */
144struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, 145struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
145 struct kernfs_root *root, bool *new_sb_created, 146 struct kernfs_root *root, unsigned long magic,
146 const void *ns) 147 bool *new_sb_created, const void *ns)
147{ 148{
148 struct super_block *sb; 149 struct super_block *sb;
149 struct kernfs_super_info *info; 150 struct kernfs_super_info *info;
@@ -166,7 +167,7 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
166 *new_sb_created = !sb->s_root; 167 *new_sb_created = !sb->s_root;
167 168
168 if (!sb->s_root) { 169 if (!sb->s_root) {
169 error = kernfs_fill_super(sb); 170 error = kernfs_fill_super(sb, magic);
170 if (error) { 171 if (error) {
171 deactivate_locked_super(sb); 172 deactivate_locked_super(sb);
172 return ERR_PTR(error); 173 return ERR_PTR(error);