Commit 2341086d authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: netns: give members of struct netns_can holding the statistics a sensible name

This patch gives the members of the struct netns_can that are holding
the statistics a sensible name, by renaming struct netns_can::can_stats
into struct netns_can::pkg_stats and struct netns_can::can_pstats into
struct netns_can::rcv_lists_stats.

The conversion is done with:

	sed -i \
		-e "s:\(struct[^*]*\*\)can_stats;.*:\1pkg_stats;:" \
		-e "s:\(struct[^*]*\*\)can_pstats;.*:\1rcv_lists_stats;:" \
		-e "s/can\.can_stats/can.pkg_stats/g" \
		-e "s/can\.can_pstats/can.rcv_lists_stats/g" \
		net/can/*.[ch] \
		include/net/netns/can.h
Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 6c43bb3a
...@@ -31,8 +31,8 @@ struct netns_can { ...@@ -31,8 +31,8 @@ struct netns_can {
struct can_dev_rcv_lists *can_rx_alldev_list; struct can_dev_rcv_lists *can_rx_alldev_list;
spinlock_t can_rcvlists_lock; spinlock_t can_rcvlists_lock;
struct timer_list can_stattimer;/* timer for statistics update */ struct timer_list can_stattimer;/* timer for statistics update */
struct can_pkg_stats *can_stats; /* packet statistics */ struct can_pkg_stats *pkg_stats;
struct can_rcv_lists_stats *can_pstats; /* receive list statistics */ struct can_rcv_lists_stats *rcv_lists_stats;
/* CAN GW per-net gateway jobs */ /* CAN GW per-net gateway jobs */
struct hlist_head cgw_list; struct hlist_head cgw_list;
......
...@@ -198,7 +198,7 @@ int can_send(struct sk_buff *skb, int loop) ...@@ -198,7 +198,7 @@ int can_send(struct sk_buff *skb, int loop)
{ {
struct sk_buff *newskb = NULL; struct sk_buff *newskb = NULL;
struct canfd_frame *cfd = (struct canfd_frame *)skb->data; struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
struct can_pkg_stats *can_stats = dev_net(skb->dev)->can.can_stats; struct can_pkg_stats *can_stats = dev_net(skb->dev)->can.pkg_stats;
int err = -EINVAL; int err = -EINVAL;
if (skb->len == CAN_MTU) { 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,7 +441,7 @@ int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id,
struct receiver *r; struct receiver *r;
struct hlist_head *rl; struct hlist_head *rl;
struct can_dev_rcv_lists *d; struct can_dev_rcv_lists *d;
struct can_rcv_lists_stats *can_pstats = net->can.can_pstats; struct can_rcv_lists_stats *can_pstats = net->can.rcv_lists_stats;
int err = 0; int err = 0;
/* insert new receiver (dev,canid,mask) -> (func,data) */ /* 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,7 +515,7 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id,
{ {
struct receiver *r = NULL; struct receiver *r = NULL;
struct hlist_head *rl; struct hlist_head *rl;
struct can_rcv_lists_stats *can_pstats = net->can.can_pstats; struct can_rcv_lists_stats *can_pstats = net->can.rcv_lists_stats;
struct can_dev_rcv_lists *d; struct can_dev_rcv_lists *d;
if (dev && dev->type != ARPHRD_CAN) if (dev && dev->type != ARPHRD_CAN)
...@@ -655,7 +655,7 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev) ...@@ -655,7 +655,7 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev)
{ {
struct can_dev_rcv_lists *d; struct can_dev_rcv_lists *d;
struct net *net = dev_net(dev); struct net *net = dev_net(dev);
struct can_pkg_stats *can_stats = net->can.can_stats; struct can_pkg_stats *can_stats = net->can.pkg_stats;
int matches; int matches;
/* update statistics */ /* update statistics */
...@@ -837,12 +837,12 @@ static int can_pernet_init(struct net *net) ...@@ -837,12 +837,12 @@ static int can_pernet_init(struct net *net)
kzalloc(sizeof(*net->can.can_rx_alldev_list), GFP_KERNEL); kzalloc(sizeof(*net->can.can_rx_alldev_list), GFP_KERNEL);
if (!net->can.can_rx_alldev_list) if (!net->can.can_rx_alldev_list)
goto out; goto out;
net->can.can_stats = kzalloc(sizeof(*net->can.can_stats), GFP_KERNEL); net->can.pkg_stats = kzalloc(sizeof(*net->can.pkg_stats), GFP_KERNEL);
if (!net->can.can_stats) if (!net->can.pkg_stats)
goto out_free_alldev_list; goto out_free_rx_alldev_list;
net->can.can_pstats = kzalloc(sizeof(*net->can.can_pstats), GFP_KERNEL); net->can.rcv_lists_stats = kzalloc(sizeof(*net->can.rcv_lists_stats), GFP_KERNEL);
if (!net->can.can_pstats) if (!net->can.rcv_lists_stats)
goto out_free_can_stats; goto out_free_pkg_stats;
if (IS_ENABLED(CONFIG_PROC_FS)) { if (IS_ENABLED(CONFIG_PROC_FS)) {
/* the statistics are updated every second (timer triggered) */ /* the statistics are updated every second (timer triggered) */
...@@ -852,15 +852,15 @@ static int can_pernet_init(struct net *net) ...@@ -852,15 +852,15 @@ static int can_pernet_init(struct net *net)
mod_timer(&net->can.can_stattimer, mod_timer(&net->can.can_stattimer,
round_jiffies(jiffies + HZ)); round_jiffies(jiffies + HZ));
} }
net->can.can_stats->jiffies_init = jiffies; net->can.pkg_stats->jiffies_init = jiffies;
can_init_proc(net); can_init_proc(net);
} }
return 0; return 0;
out_free_can_stats: out_free_pkg_stats:
kfree(net->can.can_stats); kfree(net->can.pkg_stats);
out_free_alldev_list: out_free_rx_alldev_list:
kfree(net->can.can_rx_alldev_list); kfree(net->can.can_rx_alldev_list);
out: out:
return -ENOMEM; return -ENOMEM;
...@@ -890,8 +890,8 @@ static void can_pernet_exit(struct net *net) ...@@ -890,8 +890,8 @@ static void can_pernet_exit(struct net *net)
rcu_read_unlock(); rcu_read_unlock();
kfree(net->can.can_rx_alldev_list); kfree(net->can.can_rx_alldev_list);
kfree(net->can.can_stats); kfree(net->can.pkg_stats);
kfree(net->can.can_pstats); kfree(net->can.rcv_lists_stats);
} }
/* af_can module init/exit functions */ /* af_can module init/exit functions */
......
...@@ -78,8 +78,8 @@ static const char rx_list_name[][8] = { ...@@ -78,8 +78,8 @@ static const char rx_list_name[][8] = {
static void can_init_stats(struct net *net) static void can_init_stats(struct net *net)
{ {
struct can_pkg_stats *can_stats = net->can.can_stats; struct can_pkg_stats *can_stats = net->can.pkg_stats;
struct can_rcv_lists_stats *can_pstats = net->can.can_pstats; struct can_rcv_lists_stats *can_pstats = net->can.rcv_lists_stats;
/* /*
* This memset function is called from a timer context (when * This memset function is called from a timer context (when
* can_stattimer is active which is the default) OR in a process * can_stattimer is active which is the default) OR in a process
...@@ -119,7 +119,7 @@ static unsigned long calc_rate(unsigned long oldjif, unsigned long newjif, ...@@ -119,7 +119,7 @@ static unsigned long calc_rate(unsigned long oldjif, unsigned long newjif,
void can_stat_update(struct timer_list *t) void can_stat_update(struct timer_list *t)
{ {
struct net *net = from_timer(net, t, can.can_stattimer); struct net *net = from_timer(net, t, can.can_stattimer);
struct can_pkg_stats *can_stats = net->can.can_stats; struct can_pkg_stats *can_stats = net->can.pkg_stats;
unsigned long j = jiffies; /* snapshot */ unsigned long j = jiffies; /* snapshot */
/* restart counting in timer context on user request */ /* restart counting in timer context on user request */
...@@ -212,8 +212,8 @@ static void can_print_recv_banner(struct seq_file *m) ...@@ -212,8 +212,8 @@ static void can_print_recv_banner(struct seq_file *m)
static int can_stats_proc_show(struct seq_file *m, void *v) static int can_stats_proc_show(struct seq_file *m, void *v)
{ {
struct net *net = m->private; struct net *net = m->private;
struct can_pkg_stats *can_stats = net->can.can_stats; struct can_pkg_stats *can_stats = net->can.pkg_stats;
struct can_rcv_lists_stats *can_pstats = net->can.can_pstats; struct can_rcv_lists_stats *can_pstats = net->can.rcv_lists_stats;
seq_putc(m, '\n'); seq_putc(m, '\n');
seq_printf(m, " %8ld transmitted frames (TXF)\n", can_stats->tx_frames); 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) ...@@ -274,8 +274,8 @@ static int can_stats_proc_show(struct seq_file *m, void *v)
static int can_reset_stats_proc_show(struct seq_file *m, void *v) static int can_reset_stats_proc_show(struct seq_file *m, void *v)
{ {
struct net *net = m->private; struct net *net = m->private;
struct can_rcv_lists_stats *can_pstats = net->can.can_pstats; struct can_rcv_lists_stats *can_pstats = net->can.rcv_lists_stats;
struct can_pkg_stats *can_stats = net->can.can_stats; struct can_pkg_stats *can_stats = net->can.pkg_stats;
user_reset = 1; user_reset = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment