seq_file.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef _LINUX_SEQ_FILE_H
  2. #define _LINUX_SEQ_FILE_H
  3. #ifdef __KERNEL__
  4. #include <linux/types.h>
  5. #include <linux/string.h>
  6. #include <linux/mutex.h>
  7. struct seq_operations;
  8. struct file;
  9. struct path;
  10. struct inode;
  11. struct dentry;
  12. struct seq_file {
  13. char *buf;
  14. size_t size;
  15. size_t from;
  16. size_t count;
  17. loff_t index;
  18. u64 version;
  19. struct mutex lock;
  20. const struct seq_operations *op;
  21. void *private;
  22. };
  23. struct seq_operations {
  24. void * (*start) (struct seq_file *m, loff_t *pos);
  25. void (*stop) (struct seq_file *m, void *v);
  26. void * (*next) (struct seq_file *m, void *v, loff_t *pos);
  27. int (*show) (struct seq_file *m, void *v);
  28. };
  29. #define SEQ_SKIP 1
  30. int seq_open(struct file *, const struct seq_operations *);
  31. ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
  32. loff_t seq_lseek(struct file *, loff_t, int);
  33. int seq_release(struct inode *, struct file *);
  34. int seq_escape(struct seq_file *, const char *, const char *);
  35. int seq_putc(struct seq_file *m, char c);
  36. int seq_puts(struct seq_file *m, const char *s);
  37. int seq_printf(struct seq_file *, const char *, ...)
  38. __attribute__ ((format (printf,2,3)));
  39. int seq_path(struct seq_file *, struct path *, char *);
  40. int seq_dentry(struct seq_file *, struct dentry *, char *);
  41. int seq_path_root(struct seq_file *m, struct path *path, struct path *root,
  42. char *esc);
  43. int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
  44. int single_release(struct inode *, struct file *);
  45. void *__seq_open_private(struct file *, const struct seq_operations *, int);
  46. int seq_open_private(struct file *, const struct seq_operations *, int);
  47. int seq_release_private(struct inode *, struct file *);
  48. #define SEQ_START_TOKEN ((void *)1)
  49. /*
  50. * Helpers for iteration over list_head-s in seq_files
  51. */
  52. extern struct list_head *seq_list_start(struct list_head *head,
  53. loff_t pos);
  54. extern struct list_head *seq_list_start_head(struct list_head *head,
  55. loff_t pos);
  56. extern struct list_head *seq_list_next(void *v, struct list_head *head,
  57. loff_t *ppos);
  58. #endif
  59. #endif