net: Allow devices to specify a device specific sysfs group.
authorEric W. Biederman <ebiederm@aristanetworks.com>
Thu, 29 Oct 2009 14:18:21 +0000 (14:18 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 30 Oct 2009 19:41:18 +0000 (12:41 -0700)
This isn't beautifully abstracted, but it is simple,
simplifies uses and so far is only needed for the bonding driver.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/net-sysfs.c

index 193b637889f96c4ef79a8c97f2416848b9951b44..e5ece8dceaadfdb7c023b260f680492dd8b7d7b2 100644 (file)
@@ -900,8 +900,8 @@ struct net_device
 
        /* class/net/name entry */
        struct device           dev;
-       /* space for optional statistics and wireless sysfs groups */
-       const struct attribute_group *sysfs_groups[3];
+       /* space for optional device, statistics, and wireless sysfs groups */
+       const struct attribute_group *sysfs_groups[4];
 
        /* rtnetlink link ops */
        const struct rtnl_link_ops *rtnl_link_ops;
index 89de182353b0e9ce061871854544b18d5315c987..157645c0da73943bf17bcd487b02cc5d429fe8ab 100644 (file)
@@ -544,8 +544,11 @@ int netdev_register_kobject(struct net_device *net)
        dev_set_name(dev, "%s", net->name);
 
 #ifdef CONFIG_SYSFS
-       *groups++ = &netstat_group;
+       /* Allow for a device specific group */
+       if (*groups)
+               groups++;
 
+       *groups++ = &netstat_group;
 #ifdef CONFIG_WIRELESS_EXT_SYSFS
        if (net->ieee80211_ptr)
                *groups++ = &wireless_group;