blob: 43ccd84127b6799c099d280612d20d001e63113f [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Denis V. Lunevc0f39322008-04-02 00:10:28 -07002#ifndef __SEQ_FILE_NET_H__
3#define __SEQ_FILE_NET_H__
4
5#include <linux/seq_file.h>
6
7struct net;
8extern struct net init_net;
9
10struct seq_net_private {
11#ifdef CONFIG_NET_NS
12 struct net *net;
13#endif
14};
15
16int seq_open_net(struct inode *, struct file *,
17 const struct seq_operations *, int);
Pavel Emelyanovde05c552008-07-18 04:07:21 -070018int single_open_net(struct inode *, struct file *file,
19 int (*show)(struct seq_file *, void *));
Denis V. Lunevc0f39322008-04-02 00:10:28 -070020int seq_release_net(struct inode *, struct file *);
Pavel Emelyanovb6fcbdb2008-07-18 04:07:44 -070021int single_release_net(struct inode *, struct file *);
Denis V. Lunevc0f39322008-04-02 00:10:28 -070022static inline struct net *seq_file_net(struct seq_file *seq)
23{
24#ifdef CONFIG_NET_NS
25 return ((struct seq_net_private *)seq->private)->net;
26#else
27 return &init_net;
28#endif
29}
30
31#endif