diff options
author | Tejun Heo <tj@kernel.org> | 2013-11-28 14:54:43 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-11-29 21:16:08 -0500 |
commit | 4b93dc9b1c684d0587fe44d36bbfdf45bd3bea9d (patch) | |
tree | 99a8124d0407511d6193e286b1a5b6e7d5aafdb2 /include/linux/kernfs.h | |
parent | df394fb56c64244b30b442e9e02de1a2d9c5a98b (diff) |
sysfs, kernfs: prepare mount path for kernfs
We're in the process of separating out core sysfs functionality into
kernfs which will deal with sysfs_dirents directly. This patch
rearranges mount path so that the kernfs and sysfs parts are separate.
* As sysfs_super_info won't be visible outside kernfs proper,
kernfs_super_ns() is added to allow kernfs users to access a
super_block's namespace tag.
* Generic mount operation is separated out into kernfs_mount_ns().
sysfs_mount() now just performs sysfs-specific permission check,
acquires namespace tag, and invokes kernfs_mount_ns().
* Generic superblock release is separated out into kernfs_kill_sb()
which can be used directly as file_system_type->kill_sb(). As sysfs
needs to put the namespace tag, sysfs_kill_sb() wraps
kernfs_kill_sb() with ns tag put.
* sysfs_dir_cachep init and sysfs_inode_init() are separated out into
kernfs_init(). kernfs_init() uses only small amount of memory and
trying to handle and propagate kernfs_init() failure doesn't make
much sense. Use SLAB_PANIC for sysfs_dir_cachep and make
sysfs_inode_init() panic on failure.
After this change, kernfs_init() should be called before
sysfs_init(), fs/namespace.c::mnt_init() modified accordingly.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/kernfs.h')
-rw-r--r-- | include/linux/kernfs.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index fad8b986800f..75fcbe5c9d65 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
@@ -18,6 +18,8 @@ struct file; | |||
18 | struct iattr; | 18 | struct iattr; |
19 | struct seq_file; | 19 | struct seq_file; |
20 | struct vm_area_struct; | 20 | struct vm_area_struct; |
21 | struct super_block; | ||
22 | struct file_system_type; | ||
21 | 23 | ||
22 | struct sysfs_dirent; | 24 | struct sysfs_dirent; |
23 | 25 | ||
@@ -109,6 +111,13 @@ void kernfs_enable_ns(struct sysfs_dirent *sd); | |||
109 | int kernfs_setattr(struct sysfs_dirent *sd, const struct iattr *iattr); | 111 | int kernfs_setattr(struct sysfs_dirent *sd, const struct iattr *iattr); |
110 | void kernfs_notify(struct sysfs_dirent *sd); | 112 | void kernfs_notify(struct sysfs_dirent *sd); |
111 | 113 | ||
114 | const void *kernfs_super_ns(struct super_block *sb); | ||
115 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | ||
116 | struct kernfs_root *root, const void *ns); | ||
117 | void kernfs_kill_sb(struct super_block *sb); | ||
118 | |||
119 | void kernfs_init(void); | ||
120 | |||
112 | #else /* CONFIG_SYSFS */ | 121 | #else /* CONFIG_SYSFS */ |
113 | 122 | ||
114 | static inline struct sysfs_dirent * | 123 | static inline struct sysfs_dirent * |
@@ -160,6 +169,18 @@ static inline int kernfs_setattr(struct sysfs_dirent *sd, | |||
160 | 169 | ||
161 | static inline void kernfs_notify(struct sysfs_dirent *sd) { } | 170 | static inline void kernfs_notify(struct sysfs_dirent *sd) { } |
162 | 171 | ||
172 | static inline const void *kernfs_super_ns(struct super_block *sb) | ||
173 | { return NULL; } | ||
174 | |||
175 | static inline struct dentry * | ||
176 | kernfs_mount_ns(struct file_system_type *fs_type, int flags, | ||
177 | struct kernfs_root *root, const void *ns) | ||
178 | { return ERR_PTR(-ENOSYS); } | ||
179 | |||
180 | static inline void kernfs_kill_sb(struct super_block *sb) { } | ||
181 | |||
182 | static inline void kernfs_init(void) { } | ||
183 | |||
163 | #endif /* CONFIG_SYSFS */ | 184 | #endif /* CONFIG_SYSFS */ |
164 | 185 | ||
165 | static inline struct sysfs_dirent * | 186 | static inline struct sysfs_dirent * |
@@ -201,4 +222,11 @@ static inline int kernfs_remove_by_name(struct sysfs_dirent *parent, | |||
201 | return kernfs_remove_by_name_ns(parent, name, NULL); | 222 | return kernfs_remove_by_name_ns(parent, name, NULL); |
202 | } | 223 | } |
203 | 224 | ||
225 | static inline struct dentry * | ||
226 | kernfs_mount(struct file_system_type *fs_type, int flags, | ||
227 | struct kernfs_root *root) | ||
228 | { | ||
229 | return kernfs_mount_ns(fs_type, flags, root, NULL); | ||
230 | } | ||
231 | |||
204 | #endif /* __LINUX_KERNFS_H */ | 232 | #endif /* __LINUX_KERNFS_H */ |