aboutsummaryrefslogtreecommitdiff
path: root/payloads/libpayload/include/cbfs_core.h
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2015-09-16 18:53:40 +0200
committerPatrick Georgi <pgeorgi@google.com>2015-09-17 18:48:10 +0000
commit377d1db57dae282cda94a2c24994707a32efdd00 (patch)
tree754e8782770eaf851f9843a30a66d983ec408e37 /payloads/libpayload/include/cbfs_core.h
parent81a4c85acf664156bb68807f681cd40928bf8267 (diff)
libpayload: bring in file attribute support from cbfstool
This comes from cbfstool (GPL) into libpayload (BSD-l), but I could have just as well written it in libpayload first. Change-Id: I86baefe5c299125a4733fa20523efd5d06de7182 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: http://review.coreboot.org/11675 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'payloads/libpayload/include/cbfs_core.h')
-rw-r--r--payloads/libpayload/include/cbfs_core.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/payloads/libpayload/include/cbfs_core.h b/payloads/libpayload/include/cbfs_core.h
index a95cef7a3d..a2ee74459b 100644
--- a/payloads/libpayload/include/cbfs_core.h
+++ b/payloads/libpayload/include/cbfs_core.h
@@ -132,10 +132,34 @@ struct cbfs_file {
char magic[8];
uint32_t len;
uint32_t type;
- uint32_t checksum;
+ uint32_t attributes_offset;
uint32_t offset;
+ char filename[];
} __attribute__((packed));
+/* Depending on how the header was initialized, it may be backed with 0x00 or
+ * 0xff. Support both. */
+#define CBFS_FILE_ATTR_TAG_UNUSED 0
+#define CBFS_FILE_ATTR_TAG_UNUSED2 0xffffffff
+
+/* The common fields of extended cbfs file attributes.
+ Attributes are expected to start with tag/len, then append their
+ specific fields. */
+struct cbfs_file_attribute {
+ uint32_t tag;
+ /* len covers the whole structure, incl. tag and len */
+ uint32_t len;
+ uint8_t data[0];
+} __attribute__((packed));
+
+/* Given a cbfs_file, return the first file attribute, or NULL. */
+struct cbfs_file_attribute *cbfs_file_first_attr(struct cbfs_file *file);
+
+/* Given a cbfs_file and a cbfs_file_attribute, return the attribute that
+ * follows it, or NULL. */
+struct cbfs_file_attribute *cbfs_file_next_attr(struct cbfs_file *file,
+ struct cbfs_file_attribute *attr);
+
/*** Component sub-headers ***/
/* Following are component sub-headers for the "standard"