diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-11-20 00:40:23 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 00:40:23 -0500 |
commit | eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0 (patch) | |
tree | 082d1921a5783ef5b07b4cf666804d6509f25f1a /net/core/rtnetlink.c | |
parent | d314774cf2cd5dfeb39a00d37deee65d4c627927 (diff) |
netdev: introduce dev_get_stats()
In order for the network device ops get_stats call to be immutable, the handling
of the default internal network device stats block has to be changed. Add a new
helper function which replaces the old use of internal_get_stats.
Note: change return code to make it clear that the caller should not
go changing the returned statistics.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r-- | net/core/rtnetlink.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 6f8e0778e565..790dd205bb5d 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -551,7 +551,7 @@ static void set_operstate(struct net_device *dev, unsigned char transition) | |||
551 | } | 551 | } |
552 | 552 | ||
553 | static void copy_rtnl_link_stats(struct rtnl_link_stats *a, | 553 | static void copy_rtnl_link_stats(struct rtnl_link_stats *a, |
554 | struct net_device_stats *b) | 554 | const struct net_device_stats *b) |
555 | { | 555 | { |
556 | a->rx_packets = b->rx_packets; | 556 | a->rx_packets = b->rx_packets; |
557 | a->tx_packets = b->tx_packets; | 557 | a->tx_packets = b->tx_packets; |
@@ -609,7 +609,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, | |||
609 | struct netdev_queue *txq; | 609 | struct netdev_queue *txq; |
610 | struct ifinfomsg *ifm; | 610 | struct ifinfomsg *ifm; |
611 | struct nlmsghdr *nlh; | 611 | struct nlmsghdr *nlh; |
612 | struct net_device_stats *stats; | 612 | const struct net_device_stats *stats; |
613 | struct nlattr *attr; | 613 | struct nlattr *attr; |
614 | 614 | ||
615 | nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags); | 615 | nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags); |
@@ -666,7 +666,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, | |||
666 | if (attr == NULL) | 666 | if (attr == NULL) |
667 | goto nla_put_failure; | 667 | goto nla_put_failure; |
668 | 668 | ||
669 | stats = dev->get_stats(dev); | 669 | stats = dev_get_stats(dev); |
670 | copy_rtnl_link_stats(nla_data(attr), stats); | 670 | copy_rtnl_link_stats(nla_data(attr), stats); |
671 | 671 | ||
672 | if (dev->rtnl_link_ops) { | 672 | if (dev->rtnl_link_ops) { |