diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/locking/dlm/sysfs.c | 38 | ||||
-rw-r--r-- | fs/gfs2/sys.c | 29 |
2 files changed, 25 insertions, 42 deletions
diff --git a/fs/gfs2/locking/dlm/sysfs.c b/fs/gfs2/locking/dlm/sysfs.c index ae9e6a25fe2b..a87b09839761 100644 --- a/fs/gfs2/locking/dlm/sysfs.c +++ b/fs/gfs2/locking/dlm/sysfs.c | |||
@@ -189,51 +189,39 @@ static struct kobj_type gdlm_ktype = { | |||
189 | .sysfs_ops = &gdlm_attr_ops, | 189 | .sysfs_ops = &gdlm_attr_ops, |
190 | }; | 190 | }; |
191 | 191 | ||
192 | static struct kset gdlm_kset = { | 192 | static struct kset *gdlm_kset; |
193 | .ktype = &gdlm_ktype, | ||
194 | }; | ||
195 | 193 | ||
196 | int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj) | 194 | int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj) |
197 | { | 195 | { |
198 | int error; | 196 | int error; |
199 | 197 | ||
200 | error = kobject_set_name(&ls->kobj, "%s", "lock_module"); | 198 | ls->kobj.kset = gdlm_kset; |
201 | if (error) { | 199 | error = kobject_init_and_add(&ls->kobj, &gdlm_ktype, fskobj, |
202 | log_error("can't set kobj name %d", error); | 200 | "lock_module"); |
203 | return error; | ||
204 | } | ||
205 | |||
206 | ls->kobj.kset = &gdlm_kset; | ||
207 | ls->kobj.ktype = &gdlm_ktype; | ||
208 | ls->kobj.parent = fskobj; | ||
209 | |||
210 | error = kobject_register(&ls->kobj); | ||
211 | if (error) | 201 | if (error) |
212 | log_error("can't register kobj %d", error); | 202 | log_error("can't register kobj %d", error); |
203 | kobject_uevent(&ls->kobj, KOBJ_ADD); | ||
213 | 204 | ||
214 | return error; | 205 | return error; |
215 | } | 206 | } |
216 | 207 | ||
217 | void gdlm_kobject_release(struct gdlm_ls *ls) | 208 | void gdlm_kobject_release(struct gdlm_ls *ls) |
218 | { | 209 | { |
219 | kobject_unregister(&ls->kobj); | 210 | kobject_put(&ls->kobj); |
220 | } | 211 | } |
221 | 212 | ||
222 | int gdlm_sysfs_init(void) | 213 | int gdlm_sysfs_init(void) |
223 | { | 214 | { |
224 | int error; | 215 | gdlm_kset = kset_create_and_add("lock_dlm", NULL, kernel_kobj); |
225 | 216 | if (!gdlm_kset) { | |
226 | kobject_set_name(&gdlm_kset.kobj, "lock_dlm"); | 217 | printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__); |
227 | kobj_set_kset_s(&gdlm_kset, kernel_subsys); | 218 | return -ENOMEM; |
228 | error = kset_register(&gdlm_kset); | 219 | } |
229 | if (error) | 220 | return 0; |
230 | printk("lock_dlm: cannot register kset %d\n", error); | ||
231 | |||
232 | return error; | ||
233 | } | 221 | } |
234 | 222 | ||
235 | void gdlm_sysfs_exit(void) | 223 | void gdlm_sysfs_exit(void) |
236 | { | 224 | { |
237 | kset_unregister(&gdlm_kset); | 225 | kset_unregister(gdlm_kset); |
238 | } | 226 | } |
239 | 227 | ||
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 7f828a2cc858..eaa3b7b2f99e 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -222,9 +222,7 @@ static struct kobj_type gfs2_ktype = { | |||
222 | .sysfs_ops = &gfs2_attr_ops, | 222 | .sysfs_ops = &gfs2_attr_ops, |
223 | }; | 223 | }; |
224 | 224 | ||
225 | static struct kset gfs2_kset = { | 225 | static struct kset *gfs2_kset; |
226 | .ktype = &gfs2_ktype, | ||
227 | }; | ||
228 | 226 | ||
229 | /* | 227 | /* |
230 | * display struct lm_lockstruct fields | 228 | * display struct lm_lockstruct fields |
@@ -492,14 +490,9 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) | |||
492 | { | 490 | { |
493 | int error; | 491 | int error; |
494 | 492 | ||
495 | sdp->sd_kobj.kset = &gfs2_kset; | 493 | sdp->sd_kobj.kset = gfs2_kset; |
496 | sdp->sd_kobj.ktype = &gfs2_ktype; | 494 | error = kobject_init_and_add(&sdp->sd_kobj, &gfs2_ktype, NULL, |
497 | 495 | "%s", sdp->sd_table_name); | |
498 | error = kobject_set_name(&sdp->sd_kobj, "%s", sdp->sd_table_name); | ||
499 | if (error) | ||
500 | goto fail; | ||
501 | |||
502 | error = kobject_register(&sdp->sd_kobj); | ||
503 | if (error) | 496 | if (error) |
504 | goto fail; | 497 | goto fail; |
505 | 498 | ||
@@ -519,6 +512,7 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) | |||
519 | if (error) | 512 | if (error) |
520 | goto fail_args; | 513 | goto fail_args; |
521 | 514 | ||
515 | kobject_uevent(&sdp->sd_kobj, KOBJ_ADD); | ||
522 | return 0; | 516 | return 0; |
523 | 517 | ||
524 | fail_args: | 518 | fail_args: |
@@ -528,7 +522,7 @@ fail_counters: | |||
528 | fail_lockstruct: | 522 | fail_lockstruct: |
529 | sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); | 523 | sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); |
530 | fail_reg: | 524 | fail_reg: |
531 | kobject_unregister(&sdp->sd_kobj); | 525 | kobject_put(&sdp->sd_kobj); |
532 | fail: | 526 | fail: |
533 | fs_err(sdp, "error %d adding sysfs files", error); | 527 | fs_err(sdp, "error %d adding sysfs files", error); |
534 | return error; | 528 | return error; |
@@ -540,21 +534,22 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp) | |||
540 | sysfs_remove_group(&sdp->sd_kobj, &args_group); | 534 | sysfs_remove_group(&sdp->sd_kobj, &args_group); |
541 | sysfs_remove_group(&sdp->sd_kobj, &counters_group); | 535 | sysfs_remove_group(&sdp->sd_kobj, &counters_group); |
542 | sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); | 536 | sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); |
543 | kobject_unregister(&sdp->sd_kobj); | 537 | kobject_put(&sdp->sd_kobj); |
544 | } | 538 | } |
545 | 539 | ||
546 | int gfs2_sys_init(void) | 540 | int gfs2_sys_init(void) |
547 | { | 541 | { |
548 | gfs2_sys_margs = NULL; | 542 | gfs2_sys_margs = NULL; |
549 | spin_lock_init(&gfs2_sys_margs_lock); | 543 | spin_lock_init(&gfs2_sys_margs_lock); |
550 | kobject_set_name(&gfs2_kset.kobj, "gfs2"); | 544 | gfs2_kset = kset_create_and_add("gfs2", NULL, fs_kobj); |
551 | kobj_set_kset_s(&gfs2_kset, fs_subsys); | 545 | if (!gfs2_kset) |
552 | return kset_register(&gfs2_kset); | 546 | return -ENOMEM; |
547 | return 0; | ||
553 | } | 548 | } |
554 | 549 | ||
555 | void gfs2_sys_uninit(void) | 550 | void gfs2_sys_uninit(void) |
556 | { | 551 | { |
557 | kfree(gfs2_sys_margs); | 552 | kfree(gfs2_sys_margs); |
558 | kset_unregister(&gfs2_kset); | 553 | kset_unregister(gfs2_kset); |
559 | } | 554 | } |
560 | 555 | ||