Almost nothing changes here except moving braces to the same line as the
function declaration. Everything else is largely whitespace changes and
a few dangling files with tab indents.
See scripts/codestyle
Previously, if tail was == 0, and we wrote exactly enough bytes to
the end of the buffer, then head would end up at 0 as well. This
would make the buffer instaneously empty, as head == tail.
Ran everything through scripts/codestyle.space, which uses astyle
to generally follow K&R style.
Biggest non whitespace change is pulling brackets down on function
declarations, which I'm pretty ambivalent about, but astyle insists
on taking a stance
+ Tweak read so that passing NULL for the data buffer causes the read
operation to consume bytes (move the read pointer) without copying
the data.
+ Tweak write so that passing NULL for the data buffer causes the
write operation to fill zeros instead of copying from a source
buffer.
+ Add a peek operation which will fill out (up to) 2 iovec_ts with the
contiguous regions of the cbuf which are ready to read.
+ Add a reset method which unconditionally consumes all of the data in
the cbuf.
+ Write some documentation for the interface in the header file.
Signed-off-by: John Grossman <johngro@google.com>
Change-Id: I2a2d2ab524449a10fa1e174500cd6dfa12a05a3f