diff options
author | Michael Brown | 2005-05-09 16:26:10 +0200 |
---|---|---|
committer | Michael Brown | 2005-05-09 16:26:10 +0200 |
commit | bab2924e89d98b15ee0a344ed04fe226a667612e (patch) | |
tree | 241ea9df2b583096f821734da0d2b792cf810973 /src/include/buffer.h | |
parent | Added debugging (diff) | |
download | ipxe-bab2924e89d98b15ee0a344ed04fe226a667612e.tar.gz ipxe-bab2924e89d98b15ee0a344ed04fe226a667612e.tar.xz ipxe-bab2924e89d98b15ee0a344ed04fe226a667612e.zip |
Return -1 to indicate buffer overflow. Allow buffer fill level to be read
easily from struct buffer.
Diffstat (limited to 'src/include/buffer.h')
-rw-r--r-- | src/include/buffer.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/include/buffer.h b/src/include/buffer.h index 7ed57fa2..b0de39df 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -4,6 +4,18 @@ #include "stdint.h" /* + * "start" and "end" denote the real boundaries of the buffer. "fill" + * denotes the offset to the first free block in the buffer. (If the + * buffer is full, "fill" will equal ( end - start ) ). + * + */ +struct buffer { + physaddr_t start; + physaddr_t end; + off_t fill; +}; + +/* * Free blocks in the buffer start with a "tail byte". If non-zero, * this byte indicates that the free block is the tail of the buffer, * i.e. occupies all the remaining space up to the end of the buffer. @@ -15,24 +27,17 @@ * smaller than a struct buffer_free_block. * */ - struct buffer_free_block { char tail; physaddr_t next_free; physaddr_t end; } __attribute__ (( packed )); -struct buffer { - physaddr_t start; - physaddr_t end; - physaddr_t first_free; -}; - /* Functions in buffer.c */ extern void init_buffer ( struct buffer *buffer, physaddr_t start, size_t len ); -extern off_t fill_buffer ( struct buffer *buffer, void *data, - off_t offset, size_t len ); +extern int fill_buffer ( struct buffer *buffer, void *data, + off_t offset, size_t len ); #endif /* BUFFER_H */ |