summaryrefslogtreecommitdiff
path: root/src/commonlib/bsd/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/commonlib/bsd/include')
-rw-r--r--src/commonlib/bsd/include/commonlib/bsd/cbfs_mdata.h27
-rw-r--r--src/commonlib/bsd/include/commonlib/bsd/cbfs_private.h19
-rw-r--r--src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h3
3 files changed, 31 insertions, 18 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/cbfs_mdata.h b/src/commonlib/bsd/include/commonlib/bsd/cbfs_mdata.h
new file mode 100644
index 0000000000..df13427c5f
--- /dev/null
+++ b/src/commonlib/bsd/include/commonlib/bsd/cbfs_mdata.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
+
+#ifndef _COMMONLIB_BSD_CBFS_MDATA_H_
+#define _COMMONLIB_BSD_CBFS_MDATA_H_
+
+#include <commonlib/bsd/cbfs_serialized.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/*
+ * Helper structure to allocate space for a blob of metadata on the stack.
+ * NOTE: The fields in any union cbfs_mdata or any of its substructures from cbfs_serialized.h
+ * should always remain in the same byte order as they are stored on flash (= big endian). To
+ * avoid byte-order confusion, fields should always and only be converted to host byte order at
+ * exactly the time they are read from one of these structures into their own separate variable.
+ */
+union cbfs_mdata {
+ struct cbfs_file h;
+ uint8_t raw[CBFS_METADATA_MAX_SIZE];
+};
+
+/* Finds a CBFS attribute in a metadata block. Attribute returned as-is (still big-endian).
+ If |size| is not 0, will check that it matches the length of the attribute (if found)...
+ else caller is responsible for checking the |len| field to avoid reading out-of-bounds. */
+const void *cbfs_find_attr(const union cbfs_mdata *mdata, uint32_t attr_tag, size_t size_check);
+
+#endif /* _COMMONLIB_BSD_CBFS_MDATA_H_ */
diff --git a/src/commonlib/bsd/include/commonlib/bsd/cbfs_private.h b/src/commonlib/bsd/include/commonlib/bsd/cbfs_private.h
index df5014355c..fc2d0d0457 100644
--- a/src/commonlib/bsd/include/commonlib/bsd/cbfs_private.h
+++ b/src/commonlib/bsd/include/commonlib/bsd/cbfs_private.h
@@ -5,7 +5,7 @@
#include <commonlib/bsd/cb_err.h>
-#include <commonlib/bsd/cbfs_serialized.h>
+#include <commonlib/bsd/cbfs_mdata.h>
#include <commonlib/bsd/sysincludes.h>
#include <stdbool.h>
#include <stdint.h>
@@ -41,18 +41,6 @@
*/
#include <cbfs_glue.h>
-/*
- * Helper structure to allocate space for a blob of metadata on the stack.
- * NOTE: The fields in any union cbfs_mdata or any of its substructures from cbfs_serialized.h
- * should always remain in the same byte order as they are stored on flash (= big endian). To
- * avoid byte-order confusion, fields should always and only be converted to host byte order at
- * exactly the time they are read from one of these structures into their own separate variable.
- */
-union cbfs_mdata {
- struct cbfs_file h;
- uint8_t raw[CBFS_METADATA_MAX_SIZE];
-};
-
/* Flags that modify behavior of cbfs_walk(). */
enum cbfs_walk_flags {
/* Write the calculated hash back out to |metadata_hash->hash| rather than comparing it.
@@ -130,9 +118,4 @@ cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *
/* Returns the amount of bytes actually used by the CBFS metadata cache in |mcache|. */
size_t cbfs_mcache_real_size(const void *mcache, size_t mcache_size);
-/* Finds a CBFS attribute in a metadata block. Attribute returned as-is (still big-endian).
- If |size| is not 0, will check that it matches the length of the attribute (if found)...
- else caller is responsible for checking the |len| field to avoid reading out-of-bounds. */
-const void *cbfs_find_attr(const union cbfs_mdata *mdata, uint32_t attr_tag, size_t size_check);
-
#endif /* _COMMONLIB_BSD_CBFS_PRIVATE_H_ */
diff --git a/src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h b/src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h
index dd504695b3..dc14cd5f49 100644
--- a/src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h
+++ b/src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h
@@ -13,6 +13,9 @@ enum cbfs_compression {
};
enum cbfs_type {
+ /* QUERY is an alias for DELETED that can be passed to CBFS APIs to
+ inquire about the type of a file, rather than constrain it. */
+ CBFS_TYPE_QUERY = 0,
CBFS_TYPE_DELETED = 0x00000000,
CBFS_TYPE_NULL = 0xffffffff,
CBFS_TYPE_BOOTBLOCK = 0x01,