diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-04 06:08:37 -0400 |
---|---|---|
committer | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-23 06:27:09 -0400 |
commit | 6827400713fa22312ca3b4f47b0e64871c88040c (patch) | |
tree | a42a02ce68671443576482c5e38bd42735383579 /fs/filesystems.c | |
parent | 4c150f6c30f5129bbce5c41568a285b1f7ca8d8b (diff) |
proc: move /proc/filesystems to fs/filesystems.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Diffstat (limited to 'fs/filesystems.c')
-rw-r--r-- | fs/filesystems.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/fs/filesystems.c b/fs/filesystems.c index f37f87262837..d0e20ced62dd 100644 --- a/fs/filesystems.c +++ b/fs/filesystems.c | |||
@@ -8,6 +8,8 @@ | |||
8 | 8 | ||
9 | #include <linux/syscalls.h> | 9 | #include <linux/syscalls.h> |
10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
11 | #include <linux/proc_fs.h> | ||
12 | #include <linux/seq_file.h> | ||
11 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
12 | #include <linux/kmod.h> | 14 | #include <linux/kmod.h> |
13 | #include <linux/init.h> | 15 | #include <linux/init.h> |
@@ -214,6 +216,43 @@ int get_filesystem_list(char * buf) | |||
214 | return len; | 216 | return len; |
215 | } | 217 | } |
216 | 218 | ||
219 | #ifdef CONFIG_PROC_FS | ||
220 | static int filesystems_proc_show(struct seq_file *m, void *v) | ||
221 | { | ||
222 | struct file_system_type * tmp; | ||
223 | |||
224 | read_lock(&file_systems_lock); | ||
225 | tmp = file_systems; | ||
226 | while (tmp) { | ||
227 | seq_printf(m, "%s\t%s\n", | ||
228 | (tmp->fs_flags & FS_REQUIRES_DEV) ? "" : "nodev", | ||
229 | tmp->name); | ||
230 | tmp = tmp->next; | ||
231 | } | ||
232 | read_unlock(&file_systems_lock); | ||
233 | return 0; | ||
234 | } | ||
235 | |||
236 | static int filesystems_proc_open(struct inode *inode, struct file *file) | ||
237 | { | ||
238 | return single_open(file, filesystems_proc_show, NULL); | ||
239 | } | ||
240 | |||
241 | static const struct file_operations filesystems_proc_fops = { | ||
242 | .open = filesystems_proc_open, | ||
243 | .read = seq_read, | ||
244 | .llseek = seq_lseek, | ||
245 | .release = single_release, | ||
246 | }; | ||
247 | |||
248 | static int __init proc_filesystems_init(void) | ||
249 | { | ||
250 | proc_create("filesystems", 0, NULL, &filesystems_proc_fops); | ||
251 | return 0; | ||
252 | } | ||
253 | module_init(proc_filesystems_init); | ||
254 | #endif | ||
255 | |||
217 | struct file_system_type *get_fs_type(const char *name) | 256 | struct file_system_type *get_fs_type(const char *name) |
218 | { | 257 | { |
219 | struct file_system_type *fs; | 258 | struct file_system_type *fs; |