seq_file.h 1.8 KB

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