Re: [PATCH 20/26 v5] seq_buf: Add seq_buf_can_fit() helper function

From: Joe Perches
Date: Mon Nov 17 2014 - 19:07:44 EST


On Mon, 2014-11-17 at 12:36 -0500, Steven Rostedt wrote:
> On Fri, 14 Nov 2014 23:59:07 -0500
> Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> > From: "Steven Rostedt (Red Hat)" <rostedt@xxxxxxxxxxx>
> >
> > Add a seq_buf_can_fit() helper function that removes the possible mistakes
> > of comparing the seq_buf length plus added data compared to the size of
> > the buffer.
[]
> > +static bool seq_buf_can_fit(struct seq_buf *s, size_t len)
> > +{
> > + return s->len + len < s->size;
> > +}
> > +

Why is this useful?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/