Commit 7b77b1a9c632f8f43813dd078028c250e4773ad2
Exists in
ti-linux-3.15.y
and in
1 other branch
Merge branch 'master' of http://git.kernel.org/pub/scm/linux/kernel/git/torvalds…
…/linux into ti-linux-3.15.y * 'master' of http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux: kernfs: move the last knowledge of sysfs out from kernfs Signed-off-by: Dan Murphy <DMurphy@ti.com>
Showing 4 changed files Side-by-side Diff
fs/kernfs/mount.c
... | ... | @@ -62,7 +62,7 @@ |
62 | 62 | return NULL; |
63 | 63 | } |
64 | 64 | |
65 | -static int kernfs_fill_super(struct super_block *sb) | |
65 | +static int kernfs_fill_super(struct super_block *sb, unsigned long magic) | |
66 | 66 | { |
67 | 67 | struct kernfs_super_info *info = kernfs_info(sb); |
68 | 68 | struct inode *inode; |
... | ... | @@ -70,7 +70,7 @@ |
70 | 70 | |
71 | 71 | sb->s_blocksize = PAGE_CACHE_SIZE; |
72 | 72 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; |
73 | - sb->s_magic = SYSFS_MAGIC; | |
73 | + sb->s_magic = magic; | |
74 | 74 | sb->s_op = &kernfs_sops; |
75 | 75 | sb->s_time_gran = 1; |
76 | 76 | |
... | ... | @@ -131,6 +131,7 @@ |
131 | 131 | * @fs_type: file_system_type of the fs being mounted |
132 | 132 | * @flags: mount flags specified for the mount |
133 | 133 | * @root: kernfs_root of the hierarchy being mounted |
134 | + * @magic: file system specific magic number | |
134 | 135 | * @new_sb_created: tell the caller if we allocated a new superblock |
135 | 136 | * @ns: optional namespace tag of the mount |
136 | 137 | * |
... | ... | @@ -142,8 +143,8 @@ |
142 | 143 | * The return value can be passed to the vfs layer verbatim. |
143 | 144 | */ |
144 | 145 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, |
145 | - struct kernfs_root *root, bool *new_sb_created, | |
146 | - const void *ns) | |
146 | + struct kernfs_root *root, unsigned long magic, | |
147 | + bool *new_sb_created, const void *ns) | |
147 | 148 | { |
148 | 149 | struct super_block *sb; |
149 | 150 | struct kernfs_super_info *info; |
... | ... | @@ -166,7 +167,7 @@ |
166 | 167 | *new_sb_created = !sb->s_root; |
167 | 168 | |
168 | 169 | if (!sb->s_root) { |
169 | - error = kernfs_fill_super(sb); | |
170 | + error = kernfs_fill_super(sb, magic); | |
170 | 171 | if (error) { |
171 | 172 | deactivate_locked_super(sb); |
172 | 173 | return ERR_PTR(error); |
fs/sysfs/mount.c
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 | #define DEBUG |
14 | 14 | |
15 | 15 | #include <linux/fs.h> |
16 | +#include <linux/magic.h> | |
16 | 17 | #include <linux/mount.h> |
17 | 18 | #include <linux/init.h> |
18 | 19 | #include <linux/user_namespace.h> |
... | ... | @@ -38,7 +39,8 @@ |
38 | 39 | } |
39 | 40 | |
40 | 41 | ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); |
41 | - root = kernfs_mount_ns(fs_type, flags, sysfs_root, &new_sb, ns); | |
42 | + root = kernfs_mount_ns(fs_type, flags, sysfs_root, | |
43 | + SYSFS_MAGIC, &new_sb, ns); | |
42 | 44 | if (IS_ERR(root) || !new_sb) |
43 | 45 | kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); |
44 | 46 | return root; |
include/linux/kernfs.h
... | ... | @@ -297,8 +297,8 @@ |
297 | 297 | |
298 | 298 | const void *kernfs_super_ns(struct super_block *sb); |
299 | 299 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, |
300 | - struct kernfs_root *root, bool *new_sb_created, | |
301 | - const void *ns); | |
300 | + struct kernfs_root *root, unsigned long magic, | |
301 | + bool *new_sb_created, const void *ns); | |
302 | 302 | void kernfs_kill_sb(struct super_block *sb); |
303 | 303 | |
304 | 304 | void kernfs_init(void); |
... | ... | @@ -391,7 +391,8 @@ |
391 | 391 | |
392 | 392 | static inline struct dentry * |
393 | 393 | kernfs_mount_ns(struct file_system_type *fs_type, int flags, |
394 | - struct kernfs_root *root, bool *new_sb_created, const void *ns) | |
394 | + struct kernfs_root *root, unsigned long magic, | |
395 | + bool *new_sb_created, const void *ns) | |
395 | 396 | { return ERR_PTR(-ENOSYS); } |
396 | 397 | |
397 | 398 | static inline void kernfs_kill_sb(struct super_block *sb) { } |
398 | 399 | |
... | ... | @@ -449,9 +450,11 @@ |
449 | 450 | |
450 | 451 | static inline struct dentry * |
451 | 452 | kernfs_mount(struct file_system_type *fs_type, int flags, |
452 | - struct kernfs_root *root, bool *new_sb_created) | |
453 | + struct kernfs_root *root, unsigned long magic, | |
454 | + bool *new_sb_created) | |
453 | 455 | { |
454 | - return kernfs_mount_ns(fs_type, flags, root, new_sb_created, NULL); | |
456 | + return kernfs_mount_ns(fs_type, flags, root, | |
457 | + magic, new_sb_created, NULL); | |
455 | 458 | } |
456 | 459 | |
457 | 460 | #endif /* __LINUX_KERNFS_H */ |
kernel/cgroup.c
... | ... | @@ -33,6 +33,7 @@ |
33 | 33 | #include <linux/init_task.h> |
34 | 34 | #include <linux/kernel.h> |
35 | 35 | #include <linux/list.h> |
36 | +#include <linux/magic.h> | |
36 | 37 | #include <linux/mm.h> |
37 | 38 | #include <linux/mutex.h> |
38 | 39 | #include <linux/mount.h> |
... | ... | @@ -1604,7 +1605,8 @@ |
1604 | 1605 | if (ret) |
1605 | 1606 | return ERR_PTR(ret); |
1606 | 1607 | |
1607 | - dentry = kernfs_mount(fs_type, flags, root->kf_root, &new_sb); | |
1608 | + dentry = kernfs_mount(fs_type, flags, root->kf_root, | |
1609 | + CGROUP_SUPER_MAGIC, &new_sb); | |
1608 | 1610 | if (IS_ERR(dentry) || !new_sb) |
1609 | 1611 | cgroup_put(&root->cgrp); |
1610 | 1612 | return dentry; |