diff options
author | Joe Perches <joe@perches.com> | 2014-09-29 19:08:21 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-10-29 20:26:06 -0400 |
commit | 1f33c41c03daece85a84b8dcea5733f3efe3e2b0 (patch) | |
tree | dc20bd3893f3756d30c9281c2aafc5c1170bdaee /include/linux/seq_file.h | |
parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) |
seq_file: Rename seq_overflow() to seq_has_overflowed() and make public
The return values of seq_printf/puts/putc are frequently misused.
Start down a path to remove all the return value uses of these
functions.
Move the seq_overflow() to a global inlined function called
seq_has_overflowed() that can be used by the users of seq_file() calls.
Update the documentation to not show return types for seq_printf
et al. Add a description of seq_has_overflowed().
Link: http://lkml.kernel.org/p/848ac7e3d1c31cddf638a8526fa3c59fa6fdeb8a.1412031505.git.joe@perches.com
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Joe Perches <joe@perches.com>
[ Reworked the original patch from Joe ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/seq_file.h')
-rw-r--r-- | include/linux/seq_file.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 52e0097f61f0..cf6a9daaaf6d 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -43,6 +43,21 @@ struct seq_operations { | |||
43 | #define SEQ_SKIP 1 | 43 | #define SEQ_SKIP 1 |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * seq_has_overflowed - check if the buffer has overflowed | ||
47 | * @m: the seq_file handle | ||
48 | * | ||
49 | * seq_files have a buffer which may overflow. When this happens a larger | ||
50 | * buffer is reallocated and all the data will be printed again. | ||
51 | * The overflow state is true when m->count == m->size. | ||
52 | * | ||
53 | * Returns true if the buffer received more than it can hold. | ||
54 | */ | ||
55 | static inline bool seq_has_overflowed(struct seq_file *m) | ||
56 | { | ||
57 | return m->count == m->size; | ||
58 | } | ||
59 | |||
60 | /** | ||
46 | * seq_get_buf - get buffer to write arbitrary data to | 61 | * seq_get_buf - get buffer to write arbitrary data to |
47 | * @m: the seq_file handle | 62 | * @m: the seq_file handle |
48 | * @bufp: the beginning of the buffer is stored here | 63 | * @bufp: the beginning of the buffer is stored here |