[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200427201235.2994615-1-yhs@fb.com>
Date: Mon, 27 Apr 2020 13:12:35 -0700
From: Yonghong Song <yhs@...com>
To: Andrii Nakryiko <andriin@...com>, <bpf@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>, <netdev@...r.kernel.org>
CC: Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>, <kernel-team@...com>
Subject: [PATCH bpf-next v1 01/19] net: refactor net assignment for seq_net_private structure
Refactor assignment of "net" in seq_net_private structure
in proc_net.c to a helper function. The helper later will
be used by bpfdump.
Signed-off-by: Yonghong Song <yhs@...com>
---
fs/proc/proc_net.c | 5 ++---
include/linux/seq_file_net.h | 8 ++++++++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 4888c5224442..aee07c19cf8b 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -75,9 +75,8 @@ static int seq_open_net(struct inode *inode, struct file *file)
put_net(net);
return -ENOMEM;
}
-#ifdef CONFIG_NET_NS
- p->net = net;
-#endif
+
+ set_seq_net_private(p, net);
return 0;
}
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h
index 0fdbe1ddd8d1..0ec4a18b9aca 100644
--- a/include/linux/seq_file_net.h
+++ b/include/linux/seq_file_net.h
@@ -35,4 +35,12 @@ static inline struct net *seq_file_single_net(struct seq_file *seq)
#endif
}
+static inline void set_seq_net_private(struct seq_net_private *p,
+ struct net *net)
+{
+#ifdef CONFIG_NET_NS
+ p->net = net;
+#endif
+}
+
#endif
--
2.24.1
Powered by blists - more mailing lists