Enhances seq files for networking to have a network context from the
current namespace only.
Signed-off-by: David Ahern <redacted>
---
fs/proc/proc_net.c | 2 +-
include/linux/seq_file_net.h | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 1bde894bc624..4996f5e91a90 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -54,7 +54,7 @@ int seq_open_net(struct inode *ino, struct file *f,
return -ENOMEM;
}
#ifdef CONFIG_NET_NS
- p->net = net;
+ p->net_ctx.net = net;
#endif
return 0;
}
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h
index 32c89bbe24a2..b860d053a65e 100644
--- a/include/linux/seq_file_net.h
+++ b/include/linux/seq_file_net.h
@@ -7,9 +7,7 @@ struct net;
extern struct net init_net;
struct seq_net_private {
-#ifdef CONFIG_NET_NS
- struct net *net;
-#endif
+ struct net_ctx net_ctx;
};
int seq_open_net(struct inode *, struct file *,@@ -21,10 +19,14 @@ int single_release_net(struct inode *, struct file *);
static inline struct net *seq_file_net(struct seq_file *seq)
{
#ifdef CONFIG_NET_NS
- return ((struct seq_net_private *)seq->private)->net;
+ return ((struct seq_net_private *)seq->private)->net_ctx.net;
#else
return &init_net;
#endif
}
+static inline struct net_ctx *seq_file_net_ctx(struct seq_file *seq)
+{
+ return &((struct seq_net_private *)seq->private)->net_ctx;
+}
#endif--
1.9.3 (Apple Git-50)