1 | #ifndef _LINUX_SEQ_FILE_H
|
---|
2 | #define _LINUX_SEQ_FILE_H
|
---|
3 |
|
---|
4 | #include <linux/string.h>
|
---|
5 |
|
---|
6 | struct seq_file {
|
---|
7 | char *buf;
|
---|
8 | size_t size;
|
---|
9 | size_t from;
|
---|
10 | size_t count;
|
---|
11 | size_t pad_until;
|
---|
12 | loff_t index;
|
---|
13 | loff_t read_pos;
|
---|
14 | u64 version;
|
---|
15 | struct semaphore lock;
|
---|
16 | const struct seq_operations *op;
|
---|
17 | int poll_event;
|
---|
18 | const struct file *file;
|
---|
19 | void *private;
|
---|
20 | };
|
---|
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 |
|
---|
29 | /**
|
---|
30 | * seq_has_overflowed - check if the buffer has overflowed
|
---|
31 | * @m: the seq_file handle
|
---|
32 | *
|
---|
33 | * seq_files have a buffer which may overflow. When this happens a larger
|
---|
34 | * buffer is reallocated and all the data will be printed again.
|
---|
35 | * The overflow state is true when m->count == m->size.
|
---|
36 | *
|
---|
37 | * Returns true if the buffer received more than it can hold.
|
---|
38 | */
|
---|
39 | static inline bool seq_has_overflowed(struct seq_file *m)
|
---|
40 | {
|
---|
41 | return m->count == m->size;
|
---|
42 | }
|
---|
43 |
|
---|
44 | ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
|
---|
45 | loff_t seq_lseek(struct file *, loff_t, int);
|
---|
46 |
|
---|
47 | static inline void seq_printf(struct seq_file *m, const char *fmt, ...) {}
|
---|
48 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
|
---|
49 | int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t);
|
---|
50 | int single_release(struct inode *, struct file *);
|
---|
51 |
|
---|
52 | #endif /* _LINUX_SEQ_FILE_H */
|
---|