aboutsummaryrefslogtreecommitdiff
path: root/fs/dlm/lockspace.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman2007-12-17 15:54:39 -0400
committerGreg Kroah-Hartman2008-01-24 20:40:26 -0800
commit901195ed7f4b2f30dc5a36271887939c5d7bfb9f (patch)
tree1d56af3b3484ba97a98e3649247da25ac289ec7b /fs/dlm/lockspace.c
parent43b98c4a66760d18d4056beed4078a8dbad193cc (diff)
Kobject: change GFS2 to use kobject_init_and_add
Stop using kobject_register, as this way we can control the sending of the uevent properly, after everything is properly initialized. Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r--fs/dlm/lockspace.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index e64b0dc664f3..b750f13d0328 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -168,23 +168,6 @@ static struct kobj_type dlm_ktype = {
static struct kset *dlm_kset;
-static int kobject_setup(struct dlm_ls *ls)
-{
- char lsname[DLM_LOCKSPACE_LEN];
- int error;
-
- memset(lsname, 0, DLM_LOCKSPACE_LEN);
- snprintf(lsname, DLM_LOCKSPACE_LEN, "%s", ls->ls_name);
-
- error = kobject_set_name(&ls->ls_kobj, "%s", lsname);
- if (error)
- return error;
-
- ls->ls_kobj.kset = dlm_kset;
- ls->ls_kobj.ktype = &dlm_ktype;
- return 0;
-}
-
static int do_uevent(struct dlm_ls *ls, int in)
{
int error;
@@ -545,13 +528,12 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
goto out_delist;
}
- error = kobject_setup(ls);
- if (error)
- goto out_stop;
-
- error = kobject_register(&ls->ls_kobj);
+ ls->ls_kobj.kset = dlm_kset;
+ error = kobject_init_and_add(&ls->ls_kobj, &dlm_ktype, NULL,
+ "%s", ls->ls_name);
if (error)
goto out_stop;
+ kobject_uevent(&ls->ls_kobj, KOBJ_ADD);
/* let kobject handle freeing of ls if there's an error */
do_unreg = 1;