[xferbuf] Record maximum required size
Record the maximum size required when writing into a data transfer buffer. This allows the maximum size to be determined even if allocation fails (e.g. due to a fixed-size buffer or an out-of-memory condition). In the case of a fixed-size buffer (which may already be larger than required), this allows the caller to determine the actual size used for written data. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -21,6 +21,8 @@ struct xfer_buffer {
|
||||
void *data;
|
||||
/** Size of data */
|
||||
size_t len;
|
||||
/** Maximum required size of data */
|
||||
size_t max;
|
||||
/** Current offset within data */
|
||||
size_t pos;
|
||||
/** Data transfer buffer operations */
|
||||
|
||||
Reference in New Issue
Block a user