diff options
author | Julius Werner <jwerner@chromium.org> | 2021-03-10 16:52:14 -0800 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2021-04-05 22:59:02 +0000 |
commit | 4676ec52c279d44eee44ceef40d0107b09bedce6 (patch) | |
tree | 8f47668ab5798ae83d7222447d9fba8352147073 /src/include | |
parent | d9c02cdc98ced2efb3299d0977b9f9c08793c0fd (diff) |
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/include')
-rw-r--r-- | src/include/cbfs.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/include/cbfs.h b/src/include/cbfs.h index b89a13ddd3..37bac308d8 100644 --- a/src/include/cbfs.h +++ b/src/include/cbfs.h @@ -67,7 +67,7 @@ * attributes). Must return a pointer to space of the requested size where the file data should * be loaded, or NULL to make the operation fail. */ -typedef void *(*cbfs_allocator_t)(void *arg, size_t size, union cbfs_mdata *mdata); +typedef void *(*cbfs_allocator_t)(void *arg, size_t size, const union cbfs_mdata *mdata); static inline size_t cbfs_load(const char *name, void *buf, size_t size); static inline size_t cbfs_ro_load(const char *name, void *buf, size_t size); @@ -183,9 +183,9 @@ struct _cbfs_default_allocator_arg { void *buf; size_t buf_size; }; -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); -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); /********************************************************************************************** * INLINE IMPLEMENTATIONS * |