seq_file_net.h 674 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef __SEQ_FILE_NET_H__
  2. #define __SEQ_FILE_NET_H__
  3. #include <linux/seq_file.h>
  4. struct net;
  5. extern struct net init_net;
  6. struct seq_net_private {
  7. #ifdef CONFIG_NET_NS
  8. struct net *net;
  9. #endif
  10. };
  11. int seq_open_net(struct inode *, struct file *,
  12. const struct seq_operations *, int);
  13. int single_open_net(struct inode *, struct file *file,
  14. int (*show)(struct seq_file *, void *));
  15. int seq_release_net(struct inode *, struct file *);
  16. int single_release_net(struct inode *, struct file *);
  17. static inline struct net *seq_file_net(struct seq_file *seq)
  18. {
  19. #ifdef CONFIG_NET_NS
  20. return ((struct seq_net_private *)seq->private)->net;
  21. #else
  22. return &init_net;
  23. #endif
  24. }
  25. #endif