aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/sys.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:34:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:35:13 -0500
commitdf8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e (patch)
treebc3799a43e8b94fa84b32e37b1c124d5e4868f50 /fs/gfs2/sys.c
parent556a169dab38b5100df6f4a45b655dddd3db94c1 (diff)
parent4a3ad20ccd8f4d2a0535cf98fa83f7b561ba59a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
This can be broken down into these major areas: - Documentation updates (language translations and fixes, as well as kobject and kset documenatation updates.) - major kset/kobject/ktype rework and fixes. This cleans up the kset and kobject and ktype relationship and architecture, making sense of things now, and good documenation and samples are provided for others to use. Also the attributes for kobjects are much easier to handle now. This cleaned up a LOT of code all through the kernel, making kobjects easier to use if you want to. - struct bus_type has been reworked to now handle the lifetime rules properly, as the kobject is properly dynamic. - struct driver has also been reworked, and now the lifetime issues are resolved. - the block subsystem has been converted to use struct device now, and not "raw" kobjects. This patch has been in the -mm tree for over a year now, and finally all the issues are worked out with it. Older distros now properly work with new kernels, and no userspace updates are needed at all. - nozomi driver is added. This has also been in -mm for a long time, and many people have asked for it to go in. It is now in good enough shape to do so. - lots of class_device conversions to use struct device instead. The tree is almost all cleaned up now, only SCSI and IB is the remaining code to fix up... * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (196 commits) Driver core: coding style fixes Kobject: fix coding style issues in kobject c files Kobject: fix coding style issues in kobject.h Driver core: fix coding style issues in device.h spi: use class iteration api scsi: use class iteration api rtc: use class iteration api power supply : use class iteration api ieee1394: use class iteration api Driver Core: add class iteration api Driver core: Cleanup get_device_parent() in device_add() and device_move() UIO: constify function pointer tables Driver Core: constify the name passed to platform_device_register_simple driver core: fix build with SYSFS=n sysfs: make SYSFS_DEPRECATED depend on SYSFS Driver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __init kobject: add sample code for how to use ksets/ktypes/kobjects kobject: add sample code for how to use kobjects in a simple manner. kobject: update the kobject/kset documentation kobject: remove old, outdated documentation. ...
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r--fs/gfs2/sys.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 06e0b7768d97..3a3176b846f3 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -221,9 +221,7 @@ static struct kobj_type gfs2_ktype = {
221 .sysfs_ops = &gfs2_attr_ops, 221 .sysfs_ops = &gfs2_attr_ops,
222}; 222};
223 223
224static struct kset gfs2_kset = { 224static struct kset *gfs2_kset;
225 .ktype = &gfs2_ktype,
226};
227 225
228/* 226/*
229 * display struct lm_lockstruct fields 227 * display struct lm_lockstruct fields
@@ -495,14 +493,9 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
495{ 493{
496 int error; 494 int error;
497 495
498 sdp->sd_kobj.kset = &gfs2_kset; 496 sdp->sd_kobj.kset = gfs2_kset;
499 sdp->sd_kobj.ktype = &gfs2_ktype; 497 error = kobject_init_and_add(&sdp->sd_kobj, &gfs2_ktype, NULL,
500 498 "%s", sdp->sd_table_name);
501 error = kobject_set_name(&sdp->sd_kobj, "%s", sdp->sd_table_name);
502 if (error)
503 goto fail;
504
505 error = kobject_register(&sdp->sd_kobj);
506 if (error) 499 if (error)
507 goto fail; 500 goto fail;
508 501
@@ -522,6 +515,7 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
522 if (error) 515 if (error)
523 goto fail_args; 516 goto fail_args;
524 517
518 kobject_uevent(&sdp->sd_kobj, KOBJ_ADD);
525 return 0; 519 return 0;
526 520
527fail_args: 521fail_args:
@@ -531,7 +525,7 @@ fail_counters:
531fail_lockstruct: 525fail_lockstruct:
532 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); 526 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
533fail_reg: 527fail_reg:
534 kobject_unregister(&sdp->sd_kobj); 528 kobject_put(&sdp->sd_kobj);
535fail: 529fail:
536 fs_err(sdp, "error %d adding sysfs files", error); 530 fs_err(sdp, "error %d adding sysfs files", error);
537 return error; 531 return error;
@@ -543,21 +537,22 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp)
543 sysfs_remove_group(&sdp->sd_kobj, &args_group); 537 sysfs_remove_group(&sdp->sd_kobj, &args_group);
544 sysfs_remove_group(&sdp->sd_kobj, &counters_group); 538 sysfs_remove_group(&sdp->sd_kobj, &counters_group);
545 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); 539 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
546 kobject_unregister(&sdp->sd_kobj); 540 kobject_put(&sdp->sd_kobj);
547} 541}
548 542
549int gfs2_sys_init(void) 543int gfs2_sys_init(void)
550{ 544{
551 gfs2_sys_margs = NULL; 545 gfs2_sys_margs = NULL;
552 spin_lock_init(&gfs2_sys_margs_lock); 546 spin_lock_init(&gfs2_sys_margs_lock);
553 kobject_set_name(&gfs2_kset.kobj, "gfs2"); 547 gfs2_kset = kset_create_and_add("gfs2", NULL, fs_kobj);
554 kobj_set_kset_s(&gfs2_kset, fs_subsys); 548 if (!gfs2_kset)
555 return kset_register(&gfs2_kset); 549 return -ENOMEM;
550 return 0;
556} 551}
557 552
558void gfs2_sys_uninit(void) 553void gfs2_sys_uninit(void)
559{ 554{
560 kfree(gfs2_sys_margs); 555 kfree(gfs2_sys_margs);
561 kset_unregister(&gfs2_kset); 556 kset_unregister(gfs2_kset);
562} 557}
563 558