]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/sysfs/mount.c
[SPARC64]: Fix virq decomposition.
[linux-2.6-omap-h63xx.git] / fs / sysfs / mount.c
index 6d3a6249d21cf6e708523bc905bbfb64e4128656..fbc7b65fe26267d776a105f5d37f01627edf44a2 100644 (file)
@@ -24,13 +24,10 @@ static const struct super_operations sysfs_ops = {
        .drop_inode     = sysfs_delete_inode,
 };
 
-static struct sysfs_dirent sysfs_root = {
+struct sysfs_dirent sysfs_root = {
        .s_count        = ATOMIC_INIT(1),
-       .s_sibling      = LIST_HEAD_INIT(sysfs_root.s_sibling),
-       .s_children     = LIST_HEAD_INIT(sysfs_root.s_children),
-       .s_type         = SYSFS_ROOT,
+       .s_flags        = SYSFS_ROOT,
        .s_mode         = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
-       .s_iattr        = NULL,
        .s_ino          = 1,
 };
 
@@ -46,25 +43,26 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_time_gran = 1;
        sysfs_sb = sb;
 
-       inode = new_inode(sysfs_sb);
+       /* get root inode, initialize and unlock it */
+       inode = sysfs_get_inode(&sysfs_root);
        if (!inode) {
                pr_debug("sysfs: could not get root inode\n");
                return -ENOMEM;
        }
 
-       sysfs_init_inode(&sysfs_root, inode);
-
        inode->i_op = &sysfs_dir_inode_operations;
        inode->i_fop = &sysfs_dir_operations;
-       /* directory inodes start off with i_nlink == 2 (for "." entry) */
-       inc_nlink(inode);
+       inc_nlink(inode); /* directory, account for "." */
+       unlock_new_inode(inode);
 
+       /* instantiate and link root dentry */
        root = d_alloc_root(inode);
        if (!root) {
                pr_debug("%s: could not get root dentry!\n",__FUNCTION__);
                iput(inode);
                return -ENOMEM;
        }
+       sysfs_root.s_dentry = root;
        root->d_fsdata = &sysfs_root;
        sb->s_root = root;
        return 0;
@@ -88,7 +86,7 @@ int __init sysfs_init(void)
 
        sysfs_dir_cachep = kmem_cache_create("sysfs_dir_cache",
                                              sizeof(struct sysfs_dirent),
-                                             0, 0, NULL, NULL);
+                                             0, 0, NULL);
        if (!sysfs_dir_cachep)
                goto out;