Re: [PATCH][2.6] fix bridge sysfs improperly initialised knobject

From: Stephen Hemminger
Date: Thu Jun 17 2004 - 15:48:34 EST


> The bridge sysfs interface introduced around 2.6.7-rc1 created a bad
> entry in /sys because it didn't initialise the name member of the kobject.
>
> zwane@montezuma /sys {0:0} ls -l
> total 0
> ?--------- ? ? ? ? ?
> drwxr-xr-x 17 root root 0 Jun 15 15:47 block
> drwxr-xr-x 7 root root 0 Jun 15 15:47 bus
> drwxr-xr-x 16 root root 0 Jun 15 15:47 class
> drwxr-xr-x 5 root root 0 Jun 15 15:47 devices
> drwxr-xr-x 3 root root 0 Jun 15 15:47 firmware
> drwxr-xr-x 8 root root 0 Jun 15 19:55 module
>
> Index: linux-2.6.7-rc3-mm2/net/bridge/br_sysfs_br.c
> ===================================================================
> RCS file: /home/cvsroot/linux-2.6.7-rc3-mm2/net/bridge/br_sysfs_br.c,v
> retrieving revision 1.1.1.1
> diff -u -p -B -r1.1.1.1 br_sysfs_br.c
> --- linux-2.6.7-rc3-mm2/net/bridge/br_sysfs_br.c 14 Jun 2004 12:49:12 -0000 1.1.1.1
> +++ linux-2.6.7-rc3-mm2/net/bridge/br_sysfs_br.c 16 Jun 2004 16:45:20 -0000
> @@ -305,9 +305,7 @@ static struct bin_attribute bridge_forwa
> * This is a dummy kset so bridge objects don't cause
> * hotplug events
> */
> -struct subsystem bridge_subsys = {
> - .kset = { .hotplug_ops = NULL },
> -};
> +decl_subsys_name(bridge, net_bridge, NULL, NULL);
>
> void br_sysfs_init(void)
> {


Yes, this would get rid of the name, but then wouldn't bridge show up
as top level subsystem /sys/bridge.

Is there no way to register without causing bogus hotplug events?

I am getting a bad taste about the whole sysfs programming model, since
it seems like programming by side effect. it would be better for sysfs
to handle the case of hidden subsystems, or provide an alternate way
not to generate hotplug events.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/