summaryrefslogtreecommitdiff
path: root/payloads
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 /payloads
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 'payloads')
-rw-r--r--payloads/libpayload/include/fmap.h2
-rw-r--r--payloads/libpayload/libc/fmap.c6
-rw-r--r--payloads/libpayload/libcbfs/cbfs.c2
-rw-r--r--payloads/libpayload/tests/libcbfs/cbfs-lookup-test.c20
-rw-r--r--payloads/libpayload/tests/libcbfs/cbfs-verification-test.c14
5 files changed, 22 insertions, 22 deletions
diff --git a/payloads/libpayload/include/fmap.h b/payloads/libpayload/include/fmap.h
index 53ebe23dcb..02705c23b8 100644
--- a/payloads/libpayload/include/fmap.h
+++ b/payloads/libpayload/include/fmap.h
@@ -7,6 +7,6 @@
#include <stddef.h>
/* Looks for area with |name| in FlashMap. Requires lib_sysinfo.fmap_cache. */
-cb_err_t fmap_locate_area(const char *name, size_t *offset, size_t *size);
+enum cb_err fmap_locate_area(const char *name, size_t *offset, size_t *size);
#endif /* _FMAP_H */
diff --git a/payloads/libpayload/libc/fmap.c b/payloads/libpayload/libc/fmap.c
index 2d185a7c60..2ee9e3eeaa 100644
--- a/payloads/libpayload/libc/fmap.c
+++ b/payloads/libpayload/libc/fmap.c
@@ -38,8 +38,8 @@
/* Private fmap cache. */
static struct fmap *_fmap_cache;
-static cb_err_t fmap_find_area(struct fmap *fmap, const char *name, size_t *offset,
- size_t *size)
+static enum cb_err fmap_find_area(struct fmap *fmap, const char *name, size_t *offset,
+ size_t *size)
{
for (size_t i = 0; i < le32toh(fmap->nareas); ++i) {
if (strncmp((const char *)fmap->areas[i].name, name, FMAP_STRLEN) != 0)
@@ -71,7 +71,7 @@ static bool fmap_setup_cache(void)
return false;
}
-cb_err_t fmap_locate_area(const char *name, size_t *offset, size_t *size)
+enum cb_err fmap_locate_area(const char *name, size_t *offset, size_t *size)
{
if (!_fmap_cache && !fmap_setup_cache())
return CB_ERR;
diff --git a/payloads/libpayload/libcbfs/cbfs.c b/payloads/libpayload/libcbfs/cbfs.c
index 6a996b7ad2..ff191799a4 100644
--- a/payloads/libpayload/libcbfs/cbfs.c
+++ b/payloads/libpayload/libcbfs/cbfs.c
@@ -48,7 +48,7 @@ ssize_t _cbfs_boot_lookup(const char *name, bool force_ro, union cbfs_mdata *mda
return CB_ERR;
size_t data_offset;
- cb_err_t err = CB_CBFS_CACHE_FULL;
+ enum cb_err err = CB_CBFS_CACHE_FULL;
if (cbd->mcache_size)
err = cbfs_mcache_lookup(cbd->mcache, cbd->mcache_size, name, mdata,
&data_offset);
diff --git a/payloads/libpayload/tests/libcbfs/cbfs-lookup-test.c b/payloads/libpayload/tests/libcbfs/cbfs-lookup-test.c
index 0f840763a8..0650e313e7 100644
--- a/payloads/libpayload/tests/libcbfs/cbfs-lookup-test.c
+++ b/payloads/libpayload/tests/libcbfs/cbfs-lookup-test.c
@@ -40,7 +40,7 @@ size_t ulz4fn(const void *src, size_t srcn, void *dst, size_t dstn)
static size_t test_fmap_offset = 0;
static size_t test_fmap_size = 0;
-static cb_err_t test_fmap_result = CB_SUCCESS;
+static enum cb_err test_fmap_result = CB_SUCCESS;
static void set_fmap_locate_area_results(size_t offset, size_t size, size_t result)
{
@@ -49,15 +49,15 @@ static void set_fmap_locate_area_results(size_t offset, size_t size, size_t resu
test_fmap_result = result;
}
-cb_err_t fmap_locate_area(const char *name, size_t *offset, size_t *size)
+enum cb_err fmap_locate_area(const char *name, size_t *offset, size_t *size)
{
*offset = test_fmap_offset;
*size = test_fmap_size;
return test_fmap_result;
}
-cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
- union cbfs_mdata *mdata_out, size_t *data_offset_out)
+enum cb_err cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
+ union cbfs_mdata *mdata_out, size_t *data_offset_out)
{
assert_non_null(mcache);
assert_true(mcache_size > 0 && mcache_size % CBFS_MCACHE_ALIGNMENT == 0);
@@ -66,7 +66,7 @@ cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *
check_expected(name);
- cb_err_t ret = mock_type(cb_err_t);
+ enum cb_err ret = mock_type(enum cb_err);
if (ret != CB_SUCCESS)
return ret;
@@ -75,7 +75,7 @@ cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *
return CB_SUCCESS;
}
-static void expect_cbfs_mcache_lookup(const char *name, cb_err_t err,
+static void expect_cbfs_mcache_lookup(const char *name, enum cb_err err,
const union cbfs_mdata *mdata, size_t data_offset_out)
{
expect_string(cbfs_mcache_lookup, name, name);
@@ -87,13 +87,13 @@ static void expect_cbfs_mcache_lookup(const char *name, cb_err_t err,
}
}
-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)
{
assert_non_null(dev);
check_expected(name);
- cb_err_t ret = mock_type(cb_err_t);
+ enum cb_err ret = mock_type(enum cb_err);
if (ret != CB_SUCCESS)
return ret;
@@ -102,7 +102,7 @@ cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_o
return CB_SUCCESS;
}
-static void expect_cbfs_lookup(const char *name, cb_err_t err, const union cbfs_mdata *mdata,
+static void expect_cbfs_lookup(const char *name, enum cb_err err, const union cbfs_mdata *mdata,
size_t data_offset_out)
{
expect_string(cbfs_lookup, name, name);
diff --git a/payloads/libpayload/tests/libcbfs/cbfs-verification-test.c b/payloads/libpayload/tests/libcbfs/cbfs-verification-test.c
index 2ab3d5302d..1dcccf9ce9 100644
--- a/payloads/libpayload/tests/libcbfs/cbfs-verification-test.c
+++ b/payloads/libpayload/tests/libcbfs/cbfs-verification-test.c
@@ -53,19 +53,19 @@ size_t ulz4fn(const void *src, size_t srcn, void *dst, size_t dstn)
return 0;
}
-cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
- union cbfs_mdata *mdata_out, size_t *data_offset_out)
+enum cb_err cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
+ union cbfs_mdata *mdata_out, size_t *data_offset_out)
{
return CB_CBFS_CACHE_FULL;
}
-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)
{
assert_non_null(dev);
check_expected(name);
- cb_err_t ret = mock_type(cb_err_t);
+ enum cb_err ret = mock_type(enum cb_err);
if (ret != CB_SUCCESS)
return ret;
@@ -74,7 +74,7 @@ cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_o
return CB_SUCCESS;
}
-static void expect_cbfs_lookup(const char *name, cb_err_t err, const union cbfs_mdata *mdata,
+static void expect_cbfs_lookup(const char *name, enum cb_err err, const union cbfs_mdata *mdata,
size_t data_offset_out)
{
expect_string(cbfs_lookup, name, name);
@@ -91,7 +91,7 @@ const void *cbfs_find_attr(const union cbfs_mdata *mdata, uint32_t attr_tag, siz
return mock_ptr_type(void *);
}
-cb_err_t fmap_locate_area(const char *name, size_t *offset, size_t *size)
+enum cb_err fmap_locate_area(const char *name, size_t *offset, size_t *size)
{
*offset = 0;
*size = 0;