where is the "/sys/bus" kobject created?

Robert P. J. Day rpjday at crashcourse.ca
Fri Aug 24 02:12:08 EDT 2012


  i'm currently writing a tutorial on sysfs and kobjects, and an early
section will explain where all the top level kobjects under /sys come
from.  most of them are fairly obvious.

  first, a lot of them are global kobjects, as in:

$ grep -r "struct kobject.*_kobj;" *
arch/x86/platform/uv/uv_sysfs.c:struct kobject *sgi_uv_kobj;
arch/x86/include/asm/uv/bios.h:extern struct kobject *sgi_uv_kobj;	/* /sys/firmware/sgi_uv */
arch/s390/hypfs/inode.c:static struct kobject *s390_kobj;
arch/powerpc/platforms/pseries/power.c:struct kobject *power_kobj;
arch/powerpc/platforms/pseries/mobility.c:static struct kobject *mobility_kobj;
drivers/parisc/pdc_stable.c:static struct kobject *stable_kobj;
drivers/base/hypervisor.c:struct kobject *hypervisor_kobj;
drivers/base/core.c:static struct kobject *dev_kobj;
... snip ...

and the top-level objects have a common creation call:

$ grep -r "kobject_create_and_add.*NULL" *
arch/powerpc/platforms/pseries/power.c:	power_kobj = kobject_create_and_add("power", NULL);
block/genhd.c:		block_depr = kobject_create_and_add("block", NULL);
drivers/base/hypervisor.c:	hypervisor_kobj = kobject_create_and_add("hypervisor", NULL);
drivers/base/core.c:	dev_kobj = kobject_create_and_add("dev", NULL);
drivers/base/firmware.c:	firmware_kobj = kobject_create_and_add("firmware", NULL);
drivers/staging/speakup/kobjects.c:	accessibility_kobj = kobject_create_and_add("accessibility", NULL);
fs/namespace.c:	fs_kobj = kobject_create_and_add("fs", NULL);
kernel/ksysfs.c:	kernel_kobj = kobject_create_and_add("kernel", NULL);
kernel/power/main.c:	power_kobj = kobject_create_and_add("power", NULL);
$

  but i don't see the call that creates the kobject for "/sys/bus",
and i've poked around, checking other kobject creation variations.
any hints?

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