1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __SEQ_FILE_NET_H__ 2 #ifndef __SEQ_FILE_NET_H__ 3 #define __SEQ_FILE_NET_H__ 3 #define __SEQ_FILE_NET_H__ 4 4 5 #include <linux/seq_file.h> 5 #include <linux/seq_file.h> 6 #include <net/net_trackers.h> << 7 6 8 struct net; 7 struct net; 9 extern struct net init_net; 8 extern struct net init_net; 10 9 11 struct seq_net_private { 10 struct seq_net_private { 12 #ifdef CONFIG_NET_NS 11 #ifdef CONFIG_NET_NS 13 struct net *net; !! 12 struct net *net; 14 netns_tracker ns_tracker; << 15 #endif 13 #endif 16 }; 14 }; 17 15 >> 16 int seq_open_net(struct inode *, struct file *, >> 17 const struct seq_operations *, int); >> 18 int single_open_net(struct inode *, struct file *file, >> 19 int (*show)(struct seq_file *, void *)); >> 20 int seq_release_net(struct inode *, struct file *); >> 21 int single_release_net(struct inode *, struct file *); 18 static inline struct net *seq_file_net(struct 22 static inline struct net *seq_file_net(struct seq_file *seq) 19 { 23 { 20 #ifdef CONFIG_NET_NS 24 #ifdef CONFIG_NET_NS 21 return ((struct seq_net_private *)seq- 25 return ((struct seq_net_private *)seq->private)->net; 22 #else << 23 return &init_net; << 24 #endif << 25 } << 26 << 27 /* << 28 * This one is needed for proc_create_net_sing << 29 * in private not as a struct i.e. seq_file_ne << 30 */ << 31 static inline struct net *seq_file_single_net( << 32 { << 33 #ifdef CONFIG_NET_NS << 34 return (struct net *)seq->private; << 35 #else 26 #else 36 return &init_net; 27 return &init_net; 37 #endif 28 #endif 38 } 29 } 39 30 40 #endif 31 #endif 41 32
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.