diff options
author | Michael Brown | 2007-06-20 02:12:21 +0200 |
---|---|---|
committer | Michael Brown | 2007-06-20 02:12:21 +0200 |
commit | 564ac70a4271cb115b1ef9f9aa399763c3a5e0af (patch) | |
tree | 64bdd2343bda72fbf7fdf312c6bd5679a0f1221d /src/include | |
parent | Treat URIs opened via xfer_open() and friends as relative to the (diff) | |
download | ipxe-564ac70a4271cb115b1ef9f9aa399763c3a5e0af.tar.gz ipxe-564ac70a4271cb115b1ef9f9aa399763c3a5e0af.tar.xz ipxe-564ac70a4271cb115b1ef9f9aa399763c3a5e0af.zip |
Add iob_ensure_headroom() placeholder.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gpxe/iobuf.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/include/gpxe/iobuf.h b/src/include/gpxe/iobuf.h index b5de6a51..c7451a08 100644 --- a/src/include/gpxe/iobuf.h +++ b/src/include/gpxe/iobuf.h @@ -9,6 +9,7 @@ #include <stdint.h> #include <assert.h> +#include <errno.h> #include <gpxe/list.h> /** @@ -161,6 +162,24 @@ static inline size_t iob_tailroom ( struct io_buffer *iobuf ) { return ( iobuf->end - iobuf->tail ); } +/** + * Ensure I/O buffer has sufficient headroom + * + * @v iobuf I/O buffer + * @v len Required headroom + * + * This function currently only checks for the required headroom; it + * does not reallocate the I/O buffer if required. If we ever have a + * code path that requires this functionality, it's a fairly trivial + * change to make. + */ +static inline __attribute__ (( always_inline )) int +iob_ensure_headroom ( struct io_buffer *iobuf, size_t len ) { + if ( iob_headroom ( iobuf ) >= len ) + return 0; + return -ENOBUFS; +} + extern struct io_buffer * alloc_iob ( size_t len ); extern void free_iob ( struct io_buffer *iobuf ); extern void iob_pad ( struct io_buffer *iobuf, size_t min_len ); |