compelling reason to use a kset in kernel code?

Robert P. J. Day rpjday at crashcourse.ca
Sun Oct 14 05:05:36 EDT 2012


  as a short follow-up to my earlier post, here's some actual kernel
code that uses a kset for no obvious reason -- fs/btrfs/sysfs.c:

===== start =====
static struct kset *btrfs_kset;

int btrfs_init_sysfs(void)
{
        btrfs_kset = kset_create_and_add("btrfs", NULL, fs_kobj);
        if (!btrfs_kset)
                return -ENOMEM;
        return 0;
}

void btrfs_exit_sysfs(void)
{
        kset_unregister(btrfs_kset);
}
===== end =====

  that's it, that's the entire source file, with that kset being
created with a NULL pointer to a kset_uevent_ops.  so what's the point
of that code, other than to simply have the kobject /sys/fs/btrfs
appear under /sys?  or is that the whole purpose here?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



More information about the Kernelnewbies mailing list