aboutsummaryrefslogtreecommitdiff
path: root/lib/Makefile
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-09-25 07:03:07 -0600
committerTom Rini <trini@konsulko.com>2021-10-08 15:53:26 -0400
commit67bc59df05331eaac56cd0a00219d1386130aee2 (patch)
tree4ab0700c8d9b3695e0b29537edbc6a718557612f /lib/Makefile
parent930c887e0fb88dcf1907f268960330c17999b5a3 (diff)
downloadu-boot-67bc59df05331eaac56cd0a00219d1386130aee2.zip
u-boot-67bc59df05331eaac56cd0a00219d1386130aee2.tar.gz
u-boot-67bc59df05331eaac56cd0a00219d1386130aee2.tar.bz2
Add support for an owned buffer
When passing a data buffer back from a function, it is not always clear who owns the buffer, i.e. who is responsible for freeing the memory used. An example of this is where multiple files are decompressed from the firmware image, using a temporary buffer for reading (since the compressed data has to live somewhere) and producing a temporary or permanent buffer with the resuilts. Where the firmware image can be memory-mapped, as on x86, the compressed data does not need to be buffered, but the complexity of having a buffer which is either allocated or not, makes the code hard to understand. Introduce a new 'abuf' which supports simple buffer operations: - encapsulating a buffer and its size - either allocated with malloc() or not - able to be reliably freed if necessary - able to be converted to an allocated buffer if needed This simple API makes it easier to deal with allocated and memory-mapped buffers. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/Makefile')
-rw-r--r--lib/Makefile1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 962470f..454396f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -134,6 +134,7 @@ obj-$(CONFIG_OID_REGISTRY) += oid_registry.o
obj-$(CONFIG_SSCANF) += sscanf.o
endif
+obj-y += abuf.o
obj-y += date.o
obj-y += rtc-lib.o
obj-$(CONFIG_LIB_ELF) += elf.o