diff options
author | Christoph Hellwig <hch@lst.de> | 2018-04-15 04:16:41 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:24:30 -0400 |
commit | 71a5053a41fd8ddaffb6f2d0ca469a49d622dd7c (patch) | |
tree | 83244dc547f2212d0fe346cf3284fbb68c6145f3 | |
parent | d51269592c327fcfe8ec80fd169a84f8dc0de73b (diff) |
neigh: switch to proc_create_seq_data
And use proc private data directly instead of doing a detour
through seq->private.
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | net/core/neighbour.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index ce519861be59..1fb43bff417d 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -59,7 +59,7 @@ static int pneigh_ifdown_and_unlock(struct neigh_table *tbl, | |||
59 | struct net_device *dev); | 59 | struct net_device *dev); |
60 | 60 | ||
61 | #ifdef CONFIG_PROC_FS | 61 | #ifdef CONFIG_PROC_FS |
62 | static const struct file_operations neigh_stat_seq_fops; | 62 | static const struct seq_operations neigh_stat_seq_ops; |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | /* | 65 | /* |
@@ -1558,8 +1558,8 @@ void neigh_table_init(int index, struct neigh_table *tbl) | |||
1558 | panic("cannot create neighbour cache statistics"); | 1558 | panic("cannot create neighbour cache statistics"); |
1559 | 1559 | ||
1560 | #ifdef CONFIG_PROC_FS | 1560 | #ifdef CONFIG_PROC_FS |
1561 | if (!proc_create_data(tbl->id, 0, init_net.proc_net_stat, | 1561 | if (!proc_create_seq_data(tbl->id, 0, init_net.proc_net_stat, |
1562 | &neigh_stat_seq_fops, tbl)) | 1562 | &neigh_stat_seq_ops, tbl)) |
1563 | panic("cannot create neighbour proc dir entry"); | 1563 | panic("cannot create neighbour proc dir entry"); |
1564 | #endif | 1564 | #endif |
1565 | 1565 | ||
@@ -2786,7 +2786,7 @@ EXPORT_SYMBOL(neigh_seq_stop); | |||
2786 | 2786 | ||
2787 | static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos) | 2787 | static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos) |
2788 | { | 2788 | { |
2789 | struct neigh_table *tbl = seq->private; | 2789 | struct neigh_table *tbl = PDE_DATA(file_inode(seq->file)); |
2790 | int cpu; | 2790 | int cpu; |
2791 | 2791 | ||
2792 | if (*pos == 0) | 2792 | if (*pos == 0) |
@@ -2803,7 +2803,7 @@ static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos) | |||
2803 | 2803 | ||
2804 | static void *neigh_stat_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2804 | static void *neigh_stat_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
2805 | { | 2805 | { |
2806 | struct neigh_table *tbl = seq->private; | 2806 | struct neigh_table *tbl = PDE_DATA(file_inode(seq->file)); |
2807 | int cpu; | 2807 | int cpu; |
2808 | 2808 | ||
2809 | for (cpu = *pos; cpu < nr_cpu_ids; ++cpu) { | 2809 | for (cpu = *pos; cpu < nr_cpu_ids; ++cpu) { |
@@ -2822,7 +2822,7 @@ static void neigh_stat_seq_stop(struct seq_file *seq, void *v) | |||
2822 | 2822 | ||
2823 | static int neigh_stat_seq_show(struct seq_file *seq, void *v) | 2823 | static int neigh_stat_seq_show(struct seq_file *seq, void *v) |
2824 | { | 2824 | { |
2825 | struct neigh_table *tbl = seq->private; | 2825 | struct neigh_table *tbl = PDE_DATA(file_inode(seq->file)); |
2826 | struct neigh_statistics *st = v; | 2826 | struct neigh_statistics *st = v; |
2827 | 2827 | ||
2828 | if (v == SEQ_START_TOKEN) { | 2828 | if (v == SEQ_START_TOKEN) { |
@@ -2861,25 +2861,6 @@ static const struct seq_operations neigh_stat_seq_ops = { | |||
2861 | .stop = neigh_stat_seq_stop, | 2861 | .stop = neigh_stat_seq_stop, |
2862 | .show = neigh_stat_seq_show, | 2862 | .show = neigh_stat_seq_show, |
2863 | }; | 2863 | }; |
2864 | |||
2865 | static int neigh_stat_seq_open(struct inode *inode, struct file *file) | ||
2866 | { | ||
2867 | int ret = seq_open(file, &neigh_stat_seq_ops); | ||
2868 | |||
2869 | if (!ret) { | ||
2870 | struct seq_file *sf = file->private_data; | ||
2871 | sf->private = PDE_DATA(inode); | ||
2872 | } | ||
2873 | return ret; | ||
2874 | }; | ||
2875 | |||
2876 | static const struct file_operations neigh_stat_seq_fops = { | ||
2877 | .open = neigh_stat_seq_open, | ||
2878 | .read = seq_read, | ||
2879 | .llseek = seq_lseek, | ||
2880 | .release = seq_release, | ||
2881 | }; | ||
2882 | |||
2883 | #endif /* CONFIG_PROC_FS */ | 2864 | #endif /* CONFIG_PROC_FS */ |
2884 | 2865 | ||
2885 | static inline size_t neigh_nlmsg_size(void) | 2866 | static inline size_t neigh_nlmsg_size(void) |