summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2021-03-10 16:52:14 -0800
committerJulius Werner <jwerner@chromium.org>2021-04-05 22:59:02 +0000
commit4676ec52c279d44eee44ceef40d0107b09bedce6 (patch)
tree8f47668ab5798ae83d7222447d9fba8352147073 /src/lib
parentd9c02cdc98ced2efb3299d0977b9f9c08793c0fd (diff)
downloadcoreboot-4676ec52c279d44eee44ceef40d0107b09bedce6.tar.xz
cbfs: Make `mdata` argument to cbfs_allocator_t const
Right before CB:49334 was submitted, I changed the signature of cbfs_allocator_t function pointers to include another argument passing in the already loaded CBFS metadata (to allow for the rare edge case of allocators needing to read CBFS attributes). This interface is not meant to be able to modify the passed-in metadata, so to clarify that and prevent potential errors, we should declare the argument const. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I7e3756490b9ad7ded91268c61797cef36c4118ee Reviewed-on: https://review.coreboot.org/c/coreboot/+/52081 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cbfs.c4
-rw-r--r--src/lib/rmodule.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index fbf4531862..65bb721495 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -369,7 +369,7 @@ void *_cbfs_alloc(const char *name, cbfs_allocator_t allocator, void *arg,
return loc;
}
-void *_cbfs_default_allocator(void *arg, size_t size, union cbfs_mdata *unused)
+void *_cbfs_default_allocator(void *arg, size_t size, const union cbfs_mdata *unused)
{
struct _cbfs_default_allocator_arg *darg = arg;
if (size > darg->buf_size)
@@ -377,7 +377,7 @@ void *_cbfs_default_allocator(void *arg, size_t size, union cbfs_mdata *unused)
return darg->buf;
}
-void *_cbfs_cbmem_allocator(void *arg, size_t size, union cbfs_mdata *unused)
+void *_cbfs_cbmem_allocator(void *arg, size_t size, const union cbfs_mdata *unused)
{
return cbmem_add((uintptr_t)arg, size);
}
diff --git a/src/lib/rmodule.c b/src/lib/rmodule.c
index ac9eb0b306..31bf14190f 100644
--- a/src/lib/rmodule.c
+++ b/src/lib/rmodule.c
@@ -192,7 +192,7 @@ int rmodule_load(void *base, struct rmodule *module)
}
static void *rmodule_cbfs_allocator(void *rsl_arg, size_t unused,
- union cbfs_mdata *mdata)
+ const union cbfs_mdata *mdata)
{
struct rmod_stage_load *rsl = rsl_arg;