seq_file_net.h 619 B

1234567891011121314151617181920212223242526272829
  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. static inline struct net *seq_file_net(struct seq_file *seq)
  17. {
  18. #ifdef CONFIG_NET_NS
  19. return ((struct seq_net_private *)seq->private)->net;
  20. #else
  21. return &init_net;
  22. #endif
  23. }
  24. #endif