aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r--net/core/net-sysfs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 99e7052d732..ea3bb4c3b87 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -29,6 +29,7 @@ static const char fmt_hex[] = "%#x\n";
29static const char fmt_long_hex[] = "%#lx\n"; 29static const char fmt_long_hex[] = "%#lx\n";
30static const char fmt_dec[] = "%d\n"; 30static const char fmt_dec[] = "%d\n";
31static const char fmt_ulong[] = "%lu\n"; 31static const char fmt_ulong[] = "%lu\n";
32static const char fmt_u64[] = "%llu\n";
32 33
33static inline int dev_isalive(const struct net_device *dev) 34static inline int dev_isalive(const struct net_device *dev)
34{ 35{
@@ -324,14 +325,13 @@ static ssize_t netstat_show(const struct device *d,
324 struct net_device *dev = to_net_dev(d); 325 struct net_device *dev = to_net_dev(d);
325 ssize_t ret = -EINVAL; 326 ssize_t ret = -EINVAL;
326 327
327 WARN_ON(offset > sizeof(struct net_device_stats) || 328 WARN_ON(offset > sizeof(struct rtnl_link_stats64) ||
328 offset % sizeof(unsigned long) != 0); 329 offset % sizeof(u64) != 0);
329 330
330 read_lock(&dev_base_lock); 331 read_lock(&dev_base_lock);
331 if (dev_isalive(dev)) { 332 if (dev_isalive(dev)) {
332 const struct net_device_stats *stats = dev_get_stats(dev); 333 const struct rtnl_link_stats64 *stats = dev_get_stats(dev);
333 ret = sprintf(buf, fmt_ulong, 334 ret = sprintf(buf, fmt_u64, *(u64 *)(((u8 *) stats) + offset));
334 *(unsigned long *)(((u8 *) stats) + offset));
335 } 335 }
336 read_unlock(&dev_base_lock); 336 read_unlock(&dev_base_lock);
337 return ret; 337 return ret;
@@ -343,7 +343,7 @@ static ssize_t show_##name(struct device *d, \
343 struct device_attribute *attr, char *buf) \ 343 struct device_attribute *attr, char *buf) \
344{ \ 344{ \
345 return netstat_show(d, attr, buf, \ 345 return netstat_show(d, attr, buf, \
346 offsetof(struct net_device_stats, name)); \ 346 offsetof(struct rtnl_link_stats64, name)); \
347} \ 347} \
348static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) 348static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
349 349