diff options
author | Greg KH <greg@kroah.com> | 2008-02-20 14:14:16 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:00 -0400 |
commit | e3fe4e7120bc753552b071773022efcff704e34b (patch) | |
tree | 400dea2f04ae1593e6f1f4183971e07c6b4eb03f /fs/btrfs/sysfs.c | |
parent | 6e92f5e651a34f24ab31ebdf3f113c7d23a36000 (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.c | 39 |
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 = { | |||
184 | .release = btrfs_super_release, | 184 | .release = btrfs_super_release, |
185 | }; | 185 | }; |
186 | 186 | ||
187 | static struct kset btrfs_kset; | 187 | /* /sys/fs/btrfs/ entry */ |
188 | static struct kset *btrfs_kset; | ||
188 | 189 | ||
189 | int btrfs_sysfs_add_super(struct btrfs_fs_info *fs) | 190 | int btrfs_sysfs_add_super(struct btrfs_fs_info *fs) |
190 | { | 191 | { |
@@ -208,14 +209,9 @@ int btrfs_sysfs_add_super(struct btrfs_fs_info *fs) | |||
208 | } | 209 | } |
209 | name[len] = '\0'; | 210 | name[len] = '\0'; |
210 | 211 | ||
211 | fs->super_kobj.kset = &btrfs_kset; | 212 | fs->super_kobj.kset = btrfs_kset; |
212 | fs->super_kobj.ktype = &btrfs_super_ktype; | 213 | error = kobject_init_and_add(&fs->super_kobj, &btrfs_super_ktype, |
213 | 214 | NULL, "%s", name); | |
214 | error = kobject_set_name(&fs->super_kobj, "%s", name); | ||
215 | if (error) | ||
216 | goto fail; | ||
217 | |||
218 | error = kobject_register(&fs->super_kobj); | ||
219 | if (error) | 215 | if (error) |
220 | goto fail; | 216 | goto fail; |
221 | 217 | ||
@@ -232,15 +228,9 @@ int btrfs_sysfs_add_root(struct btrfs_root *root) | |||
232 | { | 228 | { |
233 | int error; | 229 | int error; |
234 | 230 | ||
235 | root->root_kobj.ktype = &btrfs_root_ktype; | 231 | error = kobject_init_and_add(&root->root_kobj, &btrfs_root_ktype, |
236 | root->root_kobj.parent = &root->fs_info->super_kobj; | 232 | &root->fs_info->super_kobj, |
237 | 233 | "%s", root->name); | |
238 | error = kobject_set_name(&root->root_kobj, "%s", root->name); | ||
239 | if (error) { | ||
240 | goto fail; | ||
241 | } | ||
242 | |||
243 | error = kobject_register(&root->root_kobj); | ||
244 | if (error) | 234 | if (error) |
245 | goto fail; | 235 | goto fail; |
246 | 236 | ||
@@ -253,24 +243,25 @@ fail: | |||
253 | 243 | ||
254 | void btrfs_sysfs_del_root(struct btrfs_root *root) | 244 | void btrfs_sysfs_del_root(struct btrfs_root *root) |
255 | { | 245 | { |
256 | kobject_unregister(&root->root_kobj); | 246 | kobject_put(&root->root_kobj); |
257 | wait_for_completion(&root->kobj_unregister); | 247 | wait_for_completion(&root->kobj_unregister); |
258 | } | 248 | } |
259 | 249 | ||
260 | void btrfs_sysfs_del_super(struct btrfs_fs_info *fs) | 250 | void btrfs_sysfs_del_super(struct btrfs_fs_info *fs) |
261 | { | 251 | { |
262 | kobject_unregister(&fs->super_kobj); | 252 | kobject_put(&fs->super_kobj); |
263 | wait_for_completion(&fs->kobj_unregister); | 253 | wait_for_completion(&fs->kobj_unregister); |
264 | } | 254 | } |
265 | 255 | ||
266 | int btrfs_init_sysfs() | 256 | int btrfs_init_sysfs() |
267 | { | 257 | { |
268 | kobj_set_kset_s(&btrfs_kset, fs_subsys); | 258 | btrfs_kset = kset_create_and_add("btrfs", NULL, fs_kobj); |
269 | kobject_set_name(&btrfs_kset.kobj, "btrfs"); | 259 | if (!btrfs_kset) |
270 | return kset_register(&btrfs_kset); | 260 | return -ENOMEM; |
261 | return 0; | ||
271 | } | 262 | } |
272 | 263 | ||
273 | void btrfs_exit_sysfs() | 264 | void btrfs_exit_sysfs() |
274 | { | 265 | { |
275 | kset_unregister(&btrfs_kset); | 266 | kset_unregister(btrfs_kset); |
276 | } | 267 | } |