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.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 37ff9ffc55f0..6d3a6249d21c 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -29,6 +29,7 @@ static struct sysfs_dirent sysfs_root = {
29 .s_sibling = LIST_HEAD_INIT(sysfs_root.s_sibling), 29 .s_sibling = LIST_HEAD_INIT(sysfs_root.s_sibling),
30 .s_children = LIST_HEAD_INIT(sysfs_root.s_children), 30 .s_children = LIST_HEAD_INIT(sysfs_root.s_children),
31 .s_type = SYSFS_ROOT, 31 .s_type = SYSFS_ROOT,
32 .s_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
32 .s_iattr = NULL, 33 .s_iattr = NULL,
33 .s_ino = 1, 34 .s_ino = 1,
34}; 35};
@@ -45,18 +46,19 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
45 sb->s_time_gran = 1; 46 sb->s_time_gran = 1;
46 sysfs_sb = sb; 47 sysfs_sb = sb;
47 48
48 inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO, 49 inode = new_inode(sysfs_sb);
49 &sysfs_root); 50 if (!inode) {
50 if (inode) {
51 inode->i_op = &sysfs_dir_inode_operations;
52 inode->i_fop = &sysfs_dir_operations;
53 /* directory inodes start off with i_nlink == 2 (for "." entry) */
54 inc_nlink(inode);
55 } else {
56 pr_debug("sysfs: could not get root inode\n"); 51 pr_debug("sysfs: could not get root inode\n");
57 return -ENOMEM; 52 return -ENOMEM;
58 } 53 }
59 54
55 sysfs_init_inode(&sysfs_root, inode);
56
57 inode->i_op = &sysfs_dir_inode_operations;
58 inode->i_fop = &sysfs_dir_operations;
59 /* directory inodes start off with i_nlink == 2 (for "." entry) */
60 inc_nlink(inode);
61
60 root = d_alloc_root(inode); 62 root = d_alloc_root(inode);
61 if (!root) { 63 if (!root) {
62 pr_debug("%s: could not get root dentry!\n",__FUNCTION__); 64 pr_debug("%s: could not get root dentry!\n",__FUNCTION__);