summaryrefslogtreecommitdiff
path: root/include/linux/seq_file_net.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-11 13:32:45 +0300
committerChristoph Hellwig <hch@lst.de>2018-05-16 08:24:30 +0300
commita2dcdee3748b664bf011b4b12de64e945dd4c8c2 (patch)
treed113e8f1bff5bcb75f69f15532b3bf4d3be76f04 /include/linux/seq_file_net.h
parent1d98c16d444f99b7869b271c25f23f58c1ac68c1 (diff)
downloadlinux-a2dcdee3748b664bf011b4b12de64e945dd4c8c2.tar.xz
net: move seq_file_single_net to <linux/seq_file_net.h>
This helper deals with single_{open,release}_net internals and thus belongs here. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include/linux/seq_file_net.h')
-rw-r--r--include/linux/seq_file_net.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h
index 43ccd84127b6..ed20faa99e05 100644
--- a/include/linux/seq_file_net.h
+++ b/include/linux/seq_file_net.h
@@ -28,4 +28,17 @@ static inline struct net *seq_file_net(struct seq_file *seq)
#endif
}
+/*
+ * This one is needed for single_open_net since net is stored directly in
+ * private not as a struct i.e. seq_file_net can't be used.
+ */
+static inline struct net *seq_file_single_net(struct seq_file *seq)
+{
+#ifdef CONFIG_NET_NS
+ return (struct net *)seq->private;
+#else
+ return &init_net;
+#endif
+}
+
#endif