Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102600
b: refs/heads/master
c: 96e7408
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed May 21, 2008
1 parent ef0ff37 commit cf8e827
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 34ac2573e88c4f80fc5e219d8012ea383a788803
refs/heads/master: 96e74088f1da4d9a53735a4a57a4f984f86b75c6
9 changes: 4 additions & 5 deletions trunk/net/core/net-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ static ssize_t netstat_show(const struct device *d,
offset % sizeof(unsigned long) != 0);

read_lock(&dev_base_lock);
if (dev_isalive(dev) && dev->get_stats &&
(stats = (*dev->get_stats)(dev)))
if (dev_isalive(dev)) {
stats = dev->get_stats(dev);
ret = sprintf(buf, fmt_ulong,
*(unsigned long *)(((u8 *) stats) + offset));

}
read_unlock(&dev_base_lock);
return ret;
}
Expand Down Expand Up @@ -457,8 +457,7 @@ int netdev_register_kobject(struct net_device *net)
strlcpy(dev->bus_id, net->name, BUS_ID_SIZE);

#ifdef CONFIG_SYSFS
if (net->get_stats)
*groups++ = &netstat_group;
*groups++ = &netstat_group;

#ifdef CONFIG_WIRELESS_EXT
if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats)
Expand Down
20 changes: 8 additions & 12 deletions trunk/net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
{
struct ifinfomsg *ifm;
struct nlmsghdr *nlh;
struct net_device_stats *stats;
struct nlattr *attr;

nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags);
if (nlh == NULL)
Expand Down Expand Up @@ -652,19 +654,13 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
NLA_PUT(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast);
}

if (dev->get_stats) {
struct net_device_stats *stats = dev->get_stats(dev);
if (stats) {
struct nlattr *attr;
attr = nla_reserve(skb, IFLA_STATS,
sizeof(struct rtnl_link_stats));
if (attr == NULL)
goto nla_put_failure;

attr = nla_reserve(skb, IFLA_STATS,
sizeof(struct rtnl_link_stats));
if (attr == NULL)
goto nla_put_failure;

copy_rtnl_link_stats(nla_data(attr), stats);
}
}
stats = dev->get_stats(dev);
copy_rtnl_link_stats(nla_data(attr), stats);

if (dev->rtnl_link_ops) {
if (rtnl_link_fill(skb, dev) < 0)
Expand Down

0 comments on commit cf8e827

Please sign in to comment.