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>
This commit is contained in:
Joe Perches
2014-09-29 16:08:21 -07:00
committed by Steven Rostedt
parent f114040e3e
commit 1f33c41c03
3 changed files with 30 additions and 22 deletions

View File

@@ -16,17 +16,6 @@
#include <asm/uaccess.h>
#include <asm/page.h>
/*
* seq_files have a buffer which can may overflow. When this happens a larger
* buffer is reallocated and all the data will be printed again.
* The overflow state is true when m->count == m->size.
*/
static bool seq_overflow(struct seq_file *m)
{
return m->count == m->size;
}
static void seq_set_overflow(struct seq_file *m)
{
m->count = m->size;
@@ -124,7 +113,7 @@ static int traverse(struct seq_file *m, loff_t offset)
error = 0;
m->count = 0;
}
if (seq_overflow(m))
if (seq_has_overflowed(m))
goto Eoverflow;
if (pos + m->count > offset) {
m->from = offset - pos;
@@ -267,7 +256,7 @@ Fill:
break;
}
err = m->op->show(m, p);
if (seq_overflow(m) || err) {
if (seq_has_overflowed(m) || err) {
m->count = offs;
if (likely(err <= 0))
break;