summaryrefslogtreecommitdiff
path: root/include/abuf.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-01-10 17:00:03 -0700
committerTom Rini <trini@konsulko.com>2025-01-22 15:58:03 -0600
commit7ba7c1dd86cf212c7d489dbf0a07301d1a3b4d2c (patch)
tree3a642d4e47b8d0439248966cfa1eb981133c872a /include/abuf.h
parentd887432807af8bdc943e7c8caa2a528dc516f6b3 (diff)
abuf: Provide a constant buffer
Add a new initialiser which can accept a constant pointer. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/abuf.h')
-rw-r--r--include/abuf.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/abuf.h b/include/abuf.h
index de21cefade4..62ff6499a0c 100644
--- a/include/abuf.h
+++ b/include/abuf.h
@@ -158,6 +158,19 @@ void abuf_init_move(struct abuf *abuf, void *data, size_t size);
void abuf_init_set(struct abuf *abuf, void *data, size_t size);
/**
+ * abuf_init_const() - Set up a new const abuf
+ *
+ * Inits a new abuf and sets up its (unallocated) data. The only current
+ * difference between this and abuf_init_set() is the 'data' parameter is a
+ * const pointer. At some point a flag could be used to indicate const-ness.
+ *
+ * @abuf: abuf to set up
+ * @data: New contents of abuf
+ * @size: New size of abuf
+ */
+void abuf_init_const(struct abuf *abuf, const void *data, size_t size);
+
+/**
* abuf_uninit() - Free any memory used by an abuf
*
* The buffer must be inited before this can be called.