aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysfs/mount.c')
-rw-r--r--fs/sysfs/mount.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index fbc7b65fe262..c76c540be3c8 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -1,5 +1,13 @@
1/* 1/*
2 * mount.c - operations for initializing and mounting sysfs. 2 * fs/sysfs/symlink.c - operations for initializing and mounting sysfs
3 *
4 * Copyright (c) 2001-3 Patrick Mochel
5 * Copyright (c) 2007 SUSE Linux Products GmbH
6 * Copyright (c) 2007 Tejun Heo <teheo@suse.de>
7 *
8 * This file is released under the GPLv2.
9 *
10 * Please see Documentation/filesystems/sysfs.txt for more information.
3 */ 11 */
4 12
5#define DEBUG 13#define DEBUG
@@ -8,25 +16,25 @@
8#include <linux/mount.h> 16#include <linux/mount.h>
9#include <linux/pagemap.h> 17#include <linux/pagemap.h>
10#include <linux/init.h> 18#include <linux/init.h>
11#include <asm/semaphore.h>
12 19
13#include "sysfs.h" 20#include "sysfs.h"
14 21
15/* Random magic number */ 22/* Random magic number */
16#define SYSFS_MAGIC 0x62656572 23#define SYSFS_MAGIC 0x62656572
17 24
18struct vfsmount *sysfs_mount; 25static struct vfsmount *sysfs_mount;
19struct super_block * sysfs_sb = NULL; 26struct super_block * sysfs_sb = NULL;
20struct kmem_cache *sysfs_dir_cachep; 27struct kmem_cache *sysfs_dir_cachep;
21 28
22static const struct super_operations sysfs_ops = { 29static const struct super_operations sysfs_ops = {
23 .statfs = simple_statfs, 30 .statfs = simple_statfs,
24 .drop_inode = sysfs_delete_inode, 31 .drop_inode = generic_delete_inode,
25}; 32};
26 33
27struct sysfs_dirent sysfs_root = { 34struct sysfs_dirent sysfs_root = {
35 .s_name = "",
28 .s_count = ATOMIC_INIT(1), 36 .s_count = ATOMIC_INIT(1),
29 .s_flags = SYSFS_ROOT, 37 .s_flags = SYSFS_DIR,
30 .s_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO, 38 .s_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
31 .s_ino = 1, 39 .s_ino = 1,
32}; 40};
@@ -50,11 +58,6 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
50 return -ENOMEM; 58 return -ENOMEM;
51 } 59 }
52 60
53 inode->i_op = &sysfs_dir_inode_operations;
54 inode->i_fop = &sysfs_dir_operations;
55 inc_nlink(inode); /* directory, account for "." */
56 unlock_new_inode(inode);
57
58 /* instantiate and link root dentry */ 61 /* instantiate and link root dentry */
59 root = d_alloc_root(inode); 62 root = d_alloc_root(inode);
60 if (!root) { 63 if (!root) {
@@ -62,7 +65,6 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
62 iput(inode); 65 iput(inode);
63 return -ENOMEM; 66 return -ENOMEM;
64 } 67 }
65 sysfs_root.s_dentry = root;
66 root->d_fsdata = &sysfs_root; 68 root->d_fsdata = &sysfs_root;
67 sb->s_root = root; 69 sb->s_root = root;
68 return 0; 70 return 0;
@@ -77,7 +79,7 @@ static int sysfs_get_sb(struct file_system_type *fs_type,
77static struct file_system_type sysfs_fs_type = { 79static struct file_system_type sysfs_fs_type = {
78 .name = "sysfs", 80 .name = "sysfs",
79 .get_sb = sysfs_get_sb, 81 .get_sb = sysfs_get_sb,
80 .kill_sb = kill_litter_super, 82 .kill_sb = kill_anon_super,
81}; 83};
82 84
83int __init sysfs_init(void) 85int __init sysfs_init(void)