diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2014-11-06 16:38:28 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-11-19 22:01:13 -0500 |
commit | eeab98154dc0b49afd398afdd71c464a8af5911f (patch) | |
tree | d460d6f09a6a8160113d81efb6a4abe080c109c3 /include | |
parent | 0736c033a81547b1cdc5120fc8dd60e26a00fd28 (diff) | |
download | linux-stable-eeab98154dc0b49afd398afdd71c464a8af5911f.tar.gz linux-stable-eeab98154dc0b49afd398afdd71c464a8af5911f.tar.bz2 linux-stable-eeab98154dc0b49afd398afdd71c464a8af5911f.zip |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/seq_buf.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h index 5d91262433e2..93718e570d4c 100644 --- a/include/linux/seq_buf.h +++ b/include/linux/seq_buf.h @@ -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) |