seq_file.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 vfsmount;
  10. struct dentry;
  11. struct inode;
  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. 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 vfsmount *, struct dentry *, 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