All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: ipv4: route.c: simplify procfs code
@ 2021-03-16  2:57 Yejune Deng
  2021-03-16 20:34 ` Jakub Kicinski
  2021-03-16 22:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yejune Deng @ 2021-03-16  2:57 UTC (permalink / raw)
  To: davem, yoshfuji, dsahern, kuba; +Cc: netdev, linux-kernel, yejune.deng

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>
---
 net/ipv4/route.c | 34 ++++------------------------------
 1 file changed, 4 insertions(+), 30 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 80bed4242d40..fa68c2612252 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -234,19 +234,6 @@ static const struct seq_operations rt_cache_seq_ops = {
 	.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)
 {
 	int cpu;
@@ -324,19 +311,6 @@ static const struct seq_operations rt_cpu_seq_ops = {
 	.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
 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;
 
-	pde = proc_create("rt_cache", 0444, net->proc_net,
-			  &rt_cache_proc_ops);
+	pde = proc_create_seq("rt_cache", 0444, net->proc_net,
+			      &rt_cache_seq_ops);
 	if (!pde)
 		goto err1;
 
-	pde = proc_create("rt_cache", 0444,
-			  net->proc_net_stat, &rt_cpu_proc_ops);
+	pde = proc_create_seq("rt_cache", 0444, net->proc_net_stat,
+			      &rt_cpu_seq_ops);
 	if (!pde)
 		goto err2;
 
-- 
2.29.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ipv4: route.c: simplify procfs code
  2021-03-16  2:57 [PATCH] net: ipv4: route.c: simplify procfs code Yejune Deng
@ 2021-03-16 20:34 ` Jakub Kicinski
  2021-03-16 22:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-03-16 20:34 UTC (permalink / raw)
  To: Yejune Deng; +Cc: davem, yoshfuji, dsahern, netdev, linux-kernel

On Tue, 16 Mar 2021 10:57:36 +0800 Yejune Deng wrote:
> 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>

Looks equivalent to me:

Reviewed-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ipv4: route.c: simplify procfs code
  2021-03-16  2:57 [PATCH] net: ipv4: route.c: simplify procfs code Yejune Deng
  2021-03-16 20:34 ` Jakub Kicinski
@ 2021-03-16 22:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-16 22:00 UTC (permalink / raw)
  To: Yejune Deng; +Cc: davem, yoshfuji, dsahern, kuba, netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue, 16 Mar 2021 10:57:36 +0800 you wrote:
> 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>
> ---
>  net/ipv4/route.c | 34 ++++------------------------------
>  1 file changed, 4 insertions(+), 30 deletions(-)

Here is the summary with links:
  - net: ipv4: route.c: simplify procfs code
    https://git.kernel.org/netdev/net-next/c/f105f26e4560

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-16 22:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16  2:57 [PATCH] net: ipv4: route.c: simplify procfs code Yejune Deng
2021-03-16 20:34 ` Jakub Kicinski
2021-03-16 22:00 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.