From a2dcdee3748b664bf011b4b12de64e945dd4c8c2 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 11 Apr 2018 12:32:45 +0200 Subject: net: move seq_file_single_net to This helper deals with single_{open,release}_net internals and thus belongs here. Signed-off-by: Christoph Hellwig --- include/linux/seq_file_net.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/linux') 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 -- cgit v1.2.3