summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2018-10-08 03:02:26 -0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2019-09-04 07:29:13 -0400
commit6c43bb3a413c0e5a73b48f35525f8a76396cda2f (patch)
tree085bc2d316f1456dabad3d4af136163a1cf34c35
parent2c1f9e26344483e2c74e80ef708d9c7fd2e543f4 (diff)
can: netns: give structs holding the CAN statistics a sensible name
This patch renames both "struct s_stats" and "struct s_pstats", to "struct can_pkg_stats" and "struct can_rcv_lists_stats" to better reflect their meaning and improve code readability. The conversion is done with: sed -i \ -e "s/struct s_stats/struct can_pkg_stats/g" \ -e "s/struct s_pstats/struct can_rcv_lists_stats/g" \ net/can/*.[ch] \ include/net/netns/can.h Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r--include/net/netns/can.h8
-rw-r--r--net/can/af_can.c8
-rw-r--r--net/can/af_can.h4
-rw-r--r--net/can/proc.c16
4 files changed, 18 insertions, 18 deletions
diff --git a/include/net/netns/can.h b/include/net/netns/can.h
index ca9bd9fba5b5..f2e5646e36f2 100644
--- a/include/net/netns/can.h
+++ b/include/net/netns/can.h
@@ -9,8 +9,8 @@
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10 10
11struct can_dev_rcv_lists; 11struct can_dev_rcv_lists;
12struct s_stats; 12struct can_pkg_stats;
13struct s_pstats; 13struct can_rcv_lists_stats;
14 14
15struct netns_can { 15struct netns_can {
16#if IS_ENABLED(CONFIG_PROC_FS) 16#if IS_ENABLED(CONFIG_PROC_FS)
@@ -31,8 +31,8 @@ struct netns_can {
31 struct can_dev_rcv_lists *can_rx_alldev_list; 31 struct can_dev_rcv_lists *can_rx_alldev_list;
32 spinlock_t can_rcvlists_lock; 32 spinlock_t can_rcvlists_lock;
33 struct timer_list can_stattimer;/* timer for statistics update */ 33 struct timer_list can_stattimer;/* timer for statistics update */
34 struct s_stats *can_stats; /* packet statistics */ 34 struct can_pkg_stats *can_stats; /* packet statistics */
35 struct s_pstats *can_pstats; /* receive list statistics */ 35 struct can_rcv_lists_stats *can_pstats; /* receive list statistics */
36 36
37 /* CAN GW per-net gateway jobs */ 37 /* CAN GW per-net gateway jobs */
38 struct hlist_head cgw_list; 38 struct hlist_head cgw_list;
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 9a9a51847c7c..0da9e6a573c5 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -198,7 +198,7 @@ int can_send(struct sk_buff *skb, int loop)
198{ 198{
199 struct sk_buff *newskb = NULL; 199 struct sk_buff *newskb = NULL;
200 struct canfd_frame *cfd = (struct canfd_frame *)skb->data; 200 struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
201 struct s_stats *can_stats = dev_net(skb->dev)->can.can_stats; 201 struct can_pkg_stats *can_stats = dev_net(skb->dev)->can.can_stats;
202 int err = -EINVAL; 202 int err = -EINVAL;
203 203
204 if (skb->len == CAN_MTU) { 204 if (skb->len == CAN_MTU) {
@@ -441,7 +441,7 @@ int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id,
441 struct receiver *r; 441 struct receiver *r;
442 struct hlist_head *rl; 442 struct hlist_head *rl;
443 struct can_dev_rcv_lists *d; 443 struct can_dev_rcv_lists *d;
444 struct s_pstats *can_pstats = net->can.can_pstats; 444 struct can_rcv_lists_stats *can_pstats = net->can.can_pstats;
445 int err = 0; 445 int err = 0;
446 446
447 /* insert new receiver (dev,canid,mask) -> (func,data) */ 447 /* insert new receiver (dev,canid,mask) -> (func,data) */
@@ -515,7 +515,7 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id,
515{ 515{
516 struct receiver *r = NULL; 516 struct receiver *r = NULL;
517 struct hlist_head *rl; 517 struct hlist_head *rl;
518 struct s_pstats *can_pstats = net->can.can_pstats; 518 struct can_rcv_lists_stats *can_pstats = net->can.can_pstats;
519 struct can_dev_rcv_lists *d; 519 struct can_dev_rcv_lists *d;
520 520
521 if (dev && dev->type != ARPHRD_CAN) 521 if (dev && dev->type != ARPHRD_CAN)
@@ -655,7 +655,7 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev)
655{ 655{
656 struct can_dev_rcv_lists *d; 656 struct can_dev_rcv_lists *d;
657 struct net *net = dev_net(dev); 657 struct net *net = dev_net(dev);
658 struct s_stats *can_stats = net->can.can_stats; 658 struct can_pkg_stats *can_stats = net->can.can_stats;
659 int matches; 659 int matches;
660 660
661 /* update statistics */ 661 /* update statistics */
diff --git a/net/can/af_can.h b/net/can/af_can.h
index 9cdb79083623..25d22e534506 100644
--- a/net/can/af_can.h
+++ b/net/can/af_can.h
@@ -78,7 +78,7 @@ struct can_dev_rcv_lists {
78/* statistic structures */ 78/* statistic structures */
79 79
80/* can be reset e.g. by can_init_stats() */ 80/* can be reset e.g. by can_init_stats() */
81struct s_stats { 81struct can_pkg_stats {
82 unsigned long jiffies_init; 82 unsigned long jiffies_init;
83 83
84 unsigned long rx_frames; 84 unsigned long rx_frames;
@@ -103,7 +103,7 @@ struct s_stats {
103}; 103};
104 104
105/* persistent statistics */ 105/* persistent statistics */
106struct s_pstats { 106struct can_rcv_lists_stats {
107 unsigned long stats_reset; 107 unsigned long stats_reset;
108 unsigned long user_reset; 108 unsigned long user_reset;
109 unsigned long rcv_entries; 109 unsigned long rcv_entries;
diff --git a/net/can/proc.c b/net/can/proc.c
index edb822c31902..d05e8c8b420d 100644
--- a/net/can/proc.c
+++ b/net/can/proc.c
@@ -78,14 +78,14 @@ static const char rx_list_name[][8] = {
78 78
79static void can_init_stats(struct net *net) 79static void can_init_stats(struct net *net)
80{ 80{
81 struct s_stats *can_stats = net->can.can_stats; 81 struct can_pkg_stats *can_stats = net->can.can_stats;
82 struct s_pstats *can_pstats = net->can.can_pstats; 82 struct can_rcv_lists_stats *can_pstats = net->can.can_pstats;
83 /* 83 /*
84 * This memset function is called from a timer context (when 84 * This memset function is called from a timer context (when
85 * can_stattimer is active which is the default) OR in a process 85 * can_stattimer is active which is the default) OR in a process
86 * context (reading the proc_fs when can_stattimer is disabled). 86 * context (reading the proc_fs when can_stattimer is disabled).
87 */ 87 */
88 memset(can_stats, 0, sizeof(struct s_stats)); 88 memset(can_stats, 0, sizeof(struct can_pkg_stats));
89 can_stats->jiffies_init = jiffies; 89 can_stats->jiffies_init = jiffies;
90 90
91 can_pstats->stats_reset++; 91 can_pstats->stats_reset++;
@@ -119,7 +119,7 @@ static unsigned long calc_rate(unsigned long oldjif, unsigned long newjif,
119void can_stat_update(struct timer_list *t) 119void can_stat_update(struct timer_list *t)
120{ 120{
121 struct net *net = from_timer(net, t, can.can_stattimer); 121 struct net *net = from_timer(net, t, can.can_stattimer);
122 struct s_stats *can_stats = net->can.can_stats; 122 struct can_pkg_stats *can_stats = net->can.can_stats;
123 unsigned long j = jiffies; /* snapshot */ 123 unsigned long j = jiffies; /* snapshot */
124 124
125 /* restart counting in timer context on user request */ 125 /* restart counting in timer context on user request */
@@ -212,8 +212,8 @@ static void can_print_recv_banner(struct seq_file *m)
212static int can_stats_proc_show(struct seq_file *m, void *v) 212static int can_stats_proc_show(struct seq_file *m, void *v)
213{ 213{
214 struct net *net = m->private; 214 struct net *net = m->private;
215 struct s_stats *can_stats = net->can.can_stats; 215 struct can_pkg_stats *can_stats = net->can.can_stats;
216 struct s_pstats *can_pstats = net->can.can_pstats; 216 struct can_rcv_lists_stats *can_pstats = net->can.can_pstats;
217 217
218 seq_putc(m, '\n'); 218 seq_putc(m, '\n');
219 seq_printf(m, " %8ld transmitted frames (TXF)\n", can_stats->tx_frames); 219 seq_printf(m, " %8ld transmitted frames (TXF)\n", can_stats->tx_frames);
@@ -274,8 +274,8 @@ static int can_stats_proc_show(struct seq_file *m, void *v)
274static int can_reset_stats_proc_show(struct seq_file *m, void *v) 274static int can_reset_stats_proc_show(struct seq_file *m, void *v)
275{ 275{
276 struct net *net = m->private; 276 struct net *net = m->private;
277 struct s_pstats *can_pstats = net->can.can_pstats; 277 struct can_rcv_lists_stats *can_pstats = net->can.can_pstats;
278 struct s_stats *can_stats = net->can.can_stats; 278 struct can_pkg_stats *can_stats = net->can.can_stats;
279 279
280 user_reset = 1; 280 user_reset = 1;
281 281