summaryrefslogtreecommitdiff
path: root/fs/btrfs/sysfs.c
diff options
context:
space:
mode:
authorGreg KH <greg@kroah.com>2008-02-20 14:14:16 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:00 -0400
commite3fe4e7120bc753552b071773022efcff704e34b (patch)
tree400dea2f04ae1593e6f1f4183971e07c6b4eb03f /fs/btrfs/sysfs.c
parent6e92f5e651a34f24ab31ebdf3f113c7d23a36000 (diff)
btrfs: fixes for kobject changes in mainline
Here's a patch against the unstable tree that gets the code to build against Linus's current tree (2.6.24-git12). This is needed as the kobject/kset api has changed there. I tried to make the smallest changes needed, and it builds and loads successfully, but I don't have a btrfs volume anywhere (yet) to try to see if things still work properly :) Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r--fs/btrfs/sysfs.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index cd673ca9bb98..973d56e05698 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -184,7 +184,8 @@ static struct kobj_type btrfs_super_ktype = {
.release = btrfs_super_release,
};
-static struct kset btrfs_kset;
+/* /sys/fs/btrfs/ entry */
+static struct kset *btrfs_kset;
int btrfs_sysfs_add_super(struct btrfs_fs_info *fs)
{
@@ -208,14 +209,9 @@ int btrfs_sysfs_add_super(struct btrfs_fs_info *fs)
}
name[len] = '\0';
- fs->super_kobj.kset = &btrfs_kset;
- fs->super_kobj.ktype = &btrfs_super_ktype;
-
- error = kobject_set_name(&fs->super_kobj, "%s", name);
- if (error)
- goto fail;
-
- error = kobject_register(&fs->super_kobj);
+ fs->super_kobj.kset = btrfs_kset;
+ error = kobject_init_and_add(&fs->super_kobj, &btrfs_super_ktype,
+ NULL, "%s", name);
if (error)
goto fail;
@@ -232,15 +228,9 @@ int btrfs_sysfs_add_root(struct btrfs_root *root)
{
int error;
- root->root_kobj.ktype = &btrfs_root_ktype;
- root->root_kobj.parent = &root->fs_info->super_kobj;
-
- error = kobject_set_name(&root->root_kobj, "%s", root->name);
- if (error) {
- goto fail;
- }
-
- error = kobject_register(&root->root_kobj);
+ error = kobject_init_and_add(&root->root_kobj, &btrfs_root_ktype,
+ &root->fs_info->super_kobj,
+ "%s", root->name);
if (error)
goto fail;
@@ -253,24 +243,25 @@ fail:
void btrfs_sysfs_del_root(struct btrfs_root *root)
{
- kobject_unregister(&root->root_kobj);
+ kobject_put(&root->root_kobj);
wait_for_completion(&root->kobj_unregister);
}
void btrfs_sysfs_del_super(struct btrfs_fs_info *fs)
{
- kobject_unregister(&fs->super_kobj);
+ kobject_put(&fs->super_kobj);
wait_for_completion(&fs->kobj_unregister);
}
int btrfs_init_sysfs()
{
- kobj_set_kset_s(&btrfs_kset, fs_subsys);
- kobject_set_name(&btrfs_kset.kobj, "btrfs");
- return kset_register(&btrfs_kset);
+ btrfs_kset = kset_create_and_add("btrfs", NULL, fs_kobj);
+ if (!btrfs_kset)
+ return -ENOMEM;
+ return 0;
}
void btrfs_exit_sysfs()
{
- kset_unregister(&btrfs_kset);
+ kset_unregister(btrfs_kset);
}