Skip to content

Commit

Permalink
kset: convert ecryptfs to use kset_create
Browse files Browse the repository at this point in the history
Dynamically create the kset instead of declaring it statically.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Mike Halcrow <mhalcrow@us.ibm.com>
Cc: Phillip Hellewell <phillip@hellewell.homeip.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Greg Kroah-Hartman committed Jan 25, 2008
1 parent 3794491 commit 917e865
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions fs/ecryptfs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ static int ecryptfs_init_kmem_caches(void)
return 0;
}

static decl_subsys(ecryptfs, NULL);
static struct kset *ecryptfs_kset;

static ssize_t version_show(struct kset *kset, char *buff)
{
Expand Down Expand Up @@ -798,27 +798,26 @@ static int do_sysfs_registration(void)
{
int rc;

ecryptfs_subsys.kobj.kset = &fs_subsys;
rc = subsystem_register(&ecryptfs_subsys);
if (rc) {
printk(KERN_ERR
"Unable to register ecryptfs sysfs subsystem\n");
ecryptfs_kset = kset_create_and_add("ecryptfs", NULL, &fs_subsys.kobj);
if (!ecryptfs_kset) {
printk(KERN_ERR "Unable to create ecryptfs kset\n");
rc = -ENOMEM;
goto out;
}
rc = sysfs_create_group(&ecryptfs_subsys.kobj, &attr_group);
rc = sysfs_create_group(&ecryptfs_kset->kobj, &attr_group);
if (rc) {
printk(KERN_ERR
"Unable to create ecryptfs version attributes\n");
subsystem_unregister(&ecryptfs_subsys);
kset_unregister(ecryptfs_kset);
}
out:
return rc;
}

static void do_sysfs_unregistration(void)
{
sysfs_remove_group(&ecryptfs_subsys.kobj, &attr_group);
subsystem_unregister(&ecryptfs_subsys);
sysfs_remove_group(&ecryptfs_kset->kobj, &attr_group);
kset_unregister(ecryptfs_kset);
}

static int __init ecryptfs_init(void)
Expand Down

0 comments on commit 917e865

Please sign in to comment.