bloblist: Support resizing a blob

Sometimes a blob needs to expand, e.g. because it needs to hold more log
data. Add support for this. Note that the bloblist must have sufficient
spare space for this to work.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-07-05 16:32:53 -06:00
parent 56dae9ef3c
commit 1fe5937549
3 changed files with 274 additions and 2 deletions

View File

@@ -179,6 +179,19 @@ void *bloblist_ensure(uint tag, int size);
*/
int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp);
/**
* bloblist_resize() - resize a blob
*
* Any blobs above this one are relocated up or down. The resized blob remains
* in the same place.
*
* @tag: Tag to add (enum bloblist_tag_t)
* @new_size: New size of the blob (>0 to expand, <0 to contract)
* @return 0 if OK, -ENOSPC if the bloblist does not have enough space, -ENOENT
* if the tag is not found
*/
int bloblist_resize(uint tag, int new_size);
/**
* bloblist_new() - Create a new, empty bloblist of a given size
*