Thread (2 messages) 2 messages, 1 author, 2012-10-14

compelling reason to use a kset in kernel code?

From: Robert P. J. Day <hidden>
Date: 2012-10-14 09:05:36

  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
========================================================================
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help