mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
net: ipv4: route.c: simplify procfs code
proc_creat_seq() that directly take a struct seq_operations, and deal with network namespaces in ->open. Signed-off-by: Yejune Deng <yejune.deng@gmail.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
77f0cae15a
commit
f105f26e45
1 changed files with 4 additions and 30 deletions
|
@ -234,19 +234,6 @@ static const struct seq_operations rt_cache_seq_ops = {
|
||||||
.show = rt_cache_seq_show,
|
.show = rt_cache_seq_show,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int rt_cache_seq_open(struct inode *inode, struct file *file)
|
|
||||||
{
|
|
||||||
return seq_open(file, &rt_cache_seq_ops);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct proc_ops rt_cache_proc_ops = {
|
|
||||||
.proc_open = rt_cache_seq_open,
|
|
||||||
.proc_read = seq_read,
|
|
||||||
.proc_lseek = seq_lseek,
|
|
||||||
.proc_release = seq_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void *rt_cpu_seq_start(struct seq_file *seq, loff_t *pos)
|
static void *rt_cpu_seq_start(struct seq_file *seq, loff_t *pos)
|
||||||
{
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
|
@ -324,19 +311,6 @@ static const struct seq_operations rt_cpu_seq_ops = {
|
||||||
.show = rt_cpu_seq_show,
|
.show = rt_cpu_seq_show,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int rt_cpu_seq_open(struct inode *inode, struct file *file)
|
|
||||||
{
|
|
||||||
return seq_open(file, &rt_cpu_seq_ops);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct proc_ops rt_cpu_proc_ops = {
|
|
||||||
.proc_open = rt_cpu_seq_open,
|
|
||||||
.proc_read = seq_read,
|
|
||||||
.proc_lseek = seq_lseek,
|
|
||||||
.proc_release = seq_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef CONFIG_IP_ROUTE_CLASSID
|
#ifdef CONFIG_IP_ROUTE_CLASSID
|
||||||
static int rt_acct_proc_show(struct seq_file *m, void *v)
|
static int rt_acct_proc_show(struct seq_file *m, void *v)
|
||||||
{
|
{
|
||||||
|
@ -367,13 +341,13 @@ static int __net_init ip_rt_do_proc_init(struct net *net)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *pde;
|
struct proc_dir_entry *pde;
|
||||||
|
|
||||||
pde = proc_create("rt_cache", 0444, net->proc_net,
|
pde = proc_create_seq("rt_cache", 0444, net->proc_net,
|
||||||
&rt_cache_proc_ops);
|
&rt_cache_seq_ops);
|
||||||
if (!pde)
|
if (!pde)
|
||||||
goto err1;
|
goto err1;
|
||||||
|
|
||||||
pde = proc_create("rt_cache", 0444,
|
pde = proc_create_seq("rt_cache", 0444, net->proc_net_stat,
|
||||||
net->proc_net_stat, &rt_cpu_proc_ops);
|
&rt_cpu_seq_ops);
|
||||||
if (!pde)
|
if (!pde)
|
||||||
goto err2;
|
goto err2;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue