aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/linebuf.h
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2015-07-28 16:59:11 +0100
committerMichael Brown <mcb30@ipxe.org>2015-07-28 16:59:11 +0100
commit1e4ff872be639e93e8df3918a965bb08675dcc77 (patch)
tree77aed8f6f542ebe09cd66f0871ef4a184b160756 /src/include/ipxe/linebuf.h
parent20d35b014521ff27bbdacfe5245c8e081a160bb9 (diff)
downloadipxe-1e4ff872be639e93e8df3918a965bb08675dcc77.tar.gz
[linebuf] Support buffering of multiple lines
Allow line buffer to accumulate multiple lines, with buffered_line() returning each freshly-completed line as it is encountered. This allows buffered lines to be subsequently processed as a group. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/linebuf.h')
-rw-r--r--src/include/ipxe/linebuf.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/include/ipxe/linebuf.h b/src/include/ipxe/linebuf.h
index a1d56bbf5..630278a04 100644
--- a/src/include/ipxe/linebuf.h
+++ b/src/include/ipxe/linebuf.h
@@ -14,17 +14,17 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** A line buffer */
struct line_buffer {
- /** Current string in the buffer */
+ /** Data buffer */
char *data;
- /** Length of current string, excluding the terminating NUL */
+ /** Length of buffered data */
size_t len;
- /** String is ready to read */
- int ready;
+ /** Most recently consumed length */
+ size_t consumed;
};
extern char * buffered_line ( struct line_buffer *linebuf );
-extern ssize_t line_buffer ( struct line_buffer *linebuf,
- const char *data, size_t len );
+extern int line_buffer ( struct line_buffer *linebuf,
+ const char *data, size_t len );
extern void empty_line_buffer ( struct line_buffer *linebuf );
#endif /* _IPXE_LINEBUF_H */