summaryrefslogtreecommitdiff
path: root/src/commonlib/bsd/cbfs_private.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2022-03-04 17:49:56 -0800
committerJulius Werner <jwerner@chromium.org>2022-03-09 02:18:21 +0000
commit69cc557cfb6eb2cbb5b137bc206cd759c1dba5f0 (patch)
treeab51422700fa7f5257fb72cc72bf8330780f8e06 /src/commonlib/bsd/cbfs_private.c
parent270b0b60acba4802b8a9272d2727ee576733ad47 (diff)
commonlib/bsd: Remove cb_err_t
cb_err_t was meant to be used in place of `enum cb_err` in all situations, but the choice to use a typedef here seems to be controversial. We should not be arbitrarily using two different identifiers for the same thing across the codebase, so since there are no use cases for serializing enum cb_err at the moment (which would be the primary reason to typedef a fixed-width integer instead), remove cb_err_t again for now. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Iaec36210d129db26d51f0a105d3de070c03b686b Reviewed-on: https://review.coreboot.org/c/coreboot/+/62600 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/commonlib/bsd/cbfs_private.c')
-rw-r--r--src/commonlib/bsd/cbfs_private.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/commonlib/bsd/cbfs_private.c b/src/commonlib/bsd/cbfs_private.c
index a8c2a3a61f..e77c299e7b 100644
--- a/src/commonlib/bsd/cbfs_private.c
+++ b/src/commonlib/bsd/cbfs_private.c
@@ -3,8 +3,8 @@
#include <commonlib/bsd/cbfs_private.h>
#include <assert.h>
-static cb_err_t read_next_header(cbfs_dev_t dev, size_t *offset, struct cbfs_file *buffer,
- const size_t devsize)
+static enum cb_err read_next_header(cbfs_dev_t dev, size_t *offset, struct cbfs_file *buffer,
+ const size_t devsize)
{
DEBUG("Looking for next file @%#zx...\n", *offset);
*offset = ALIGN_UP(*offset, CBFS_ALIGNMENT);
@@ -22,10 +22,10 @@ static cb_err_t read_next_header(cbfs_dev_t dev, size_t *offset, struct cbfs_fil
return CB_CBFS_NOT_FOUND;
}
-cb_err_t cbfs_walk(cbfs_dev_t dev, cb_err_t (*walker)(cbfs_dev_t dev, size_t offset,
- const union cbfs_mdata *mdata,
- size_t already_read, void *arg),
- void *arg, struct vb2_hash *metadata_hash, enum cbfs_walk_flags flags)
+enum cb_err cbfs_walk(cbfs_dev_t dev, enum cb_err (*walker)(cbfs_dev_t dev, size_t offset,
+ const union cbfs_mdata *mdata,
+ size_t already_read, void *arg),
+ void *arg, struct vb2_hash *metadata_hash, enum cbfs_walk_flags flags)
{
const bool do_hash = CBFS_ENABLE_HASHING && metadata_hash;
const size_t devsize = cbfs_dev_size(dev);
@@ -39,8 +39,8 @@ cb_err_t cbfs_walk(cbfs_dev_t dev, cb_err_t (*walker)(cbfs_dev_t dev, size_t off
}
size_t offset = 0;
- cb_err_t ret_header;
- cb_err_t ret_walker = CB_CBFS_NOT_FOUND;
+ enum cb_err ret_header;
+ enum cb_err ret_walker = CB_CBFS_NOT_FOUND;
union cbfs_mdata mdata;
while ((ret_header = read_next_header(dev, &offset, &mdata.h, devsize)) == CB_SUCCESS) {
const uint32_t attr_offset = be32toh(mdata.h.attributes_offset);
@@ -113,8 +113,8 @@ next_file:
return ret_walker;
}
-cb_err_t cbfs_copy_fill_metadata(union cbfs_mdata *dst, const union cbfs_mdata *src,
- size_t already_read, cbfs_dev_t dev, size_t offset)
+enum cb_err cbfs_copy_fill_metadata(union cbfs_mdata *dst, const union cbfs_mdata *src,
+ size_t already_read, cbfs_dev_t dev, size_t offset)
{
/* First, copy the stuff that cbfs_walk() already read for us. */
memcpy(dst, src, already_read);
@@ -135,8 +135,8 @@ struct cbfs_lookup_args {
size_t *data_offset_out;
};
-static cb_err_t lookup_walker(cbfs_dev_t dev, size_t offset, const union cbfs_mdata *mdata,
- size_t already_read, void *arg)
+static enum cb_err lookup_walker(cbfs_dev_t dev, size_t offset, const union cbfs_mdata *mdata,
+ size_t already_read, void *arg)
{
struct cbfs_lookup_args *args = arg;
/* Check if the name we're looking for could fit, then we can safely memcmp() it. */
@@ -152,8 +152,8 @@ static cb_err_t lookup_walker(cbfs_dev_t dev, size_t offset, const union cbfs_md
return CB_SUCCESS;
}
-cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
- size_t *data_offset_out, struct vb2_hash *metadata_hash)
+enum cb_err cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
+ size_t *data_offset_out, struct vb2_hash *metadata_hash)
{
struct cbfs_lookup_args args = {
.mdata_out = mdata_out,