seq_file.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. loff_t 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. int seq_release_private(struct inode *, struct file *);
  42. #define SEQ_START_TOKEN ((void *)1)
  43. #endif
  44. #endif