seq_buf: Create seq_buf_used() to find out how much was written
Add a helper function seq_buf_used() that replaces the SEQ_BUF_USED() private macro to let callers have a method to know how much of the seq_buf was written to. Link: http://lkml.kernel.org/r/20141114011412.170377300@goodmis.org Link: http://lkml.kernel.org/r/20141114011413.321654244@goodmis.org Reviewed-by: Petr Mladek <pmladek@suse.cz> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:

committed by
Steven Rostedt

parent
0736c033a8
commit
eeab98154d
@@ -64,6 +64,12 @@ seq_buf_buffer_left(struct seq_buf *s)
|
||||
return (s->size - 1) - s->len;
|
||||
}
|
||||
|
||||
/* How much buffer was written? */
|
||||
static inline unsigned int seq_buf_used(struct seq_buf *s)
|
||||
{
|
||||
return min(s->len, s->size);
|
||||
}
|
||||
|
||||
extern __printf(2, 3)
|
||||
int seq_buf_printf(struct seq_buf *s, const char *fmt, ...);
|
||||
extern __printf(2, 0)
|
||||
|
Reference in New Issue
Block a user