1#ifndef _LINUX_SEQ_FILE_H 2#define _LINUX_SEQ_FILE_H 3#ifdef __KERNEL__ 4 5struct seq_operations; 6 7struct seq_file { 8 char *buf; 9 size_t size; 10 size_t from; 11 size_t count; 12 loff_t index; 13 struct semaphore sem; 14 struct seq_operations *op; 15 void *private; 16}; 17 18struct seq_operations { 19 void * (*start) (struct seq_file *m, loff_t *pos); 20 void (*stop) (struct seq_file *m, void *v); 21 void * (*next) (struct seq_file *m, void *v, loff_t *pos); 22 int (*show) (struct seq_file *m, void *v); 23}; 24 25int seq_open(struct file *, struct seq_operations *); 26ssize_t seq_read(struct file *, char *, size_t, loff_t *); 27loff_t seq_lseek(struct file *, loff_t, int); 28int seq_release(struct inode *, struct file *); 29int seq_escape(struct seq_file *, const char *, const char *); 30 31static inline int seq_putc(struct seq_file *m, char c) 32{ 33 if (m->count < m->size) { 34 m->buf[m->count++] = c; 35 return 0; 36 } 37 return -1; 38} 39 40static inline int seq_puts(struct seq_file *m, const char *s) 41{ 42 int len = strlen(s); 43 if (m->count + len < m->size) { 44 memcpy(m->buf + m->count, s, len); 45 m->count += len; 46 return 0; 47 } 48 m->count = m->size; 49 return -1; 50} 51 52int seq_printf(struct seq_file *, const char *, ...) 53 __attribute__ ((format (printf,2,3))); 54 55#endif 56#endif 57

