summaryrefslogtreecommitdiff
path: root/futility/file_type.h
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2015-03-26 15:31:54 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-03-31 06:28:09 +0000
commit6ea2f72d0356a73915b736a5ef3498ac06a50770 (patch)
tree32934d70b776950a78511e965d1b672f8f7b1c7b /futility/file_type.h
parent35c69cc159af325261a1365cce28f6ecf106307f (diff)
downloadvboot-6ea2f72d0356a73915b736a5ef3498ac06a50770.tar.gz
futility: refactor to handle each file type individually
Instead of calling futil_traverse() to iterate through a preset list of functions, this establishes a separate show() and sign() function for each type of file. The only significant change is that walking through the FMAP areas within BIOS images is done in BIOS-specific functions instead of that being the "normal" case with every other type of file skipping that traversal. This is a refactoring only. There is no externally visible change. BUG=chromium:231574 BRANCH=none TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I7080afb43e35308c8bb618793c8382c2efb3d6a1 Reviewed-on: https://chromium-review.googlesource.com/262894 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'futility/file_type.h')
-rw-r--r--futility/file_type.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/futility/file_type.h b/futility/file_type.h
index 58e14383..a1be2172 100644
--- a/futility/file_type.h
+++ b/futility/file_type.h
@@ -39,6 +39,24 @@ enum futil_file_type futil_file_type_buf(uint8_t *buf, uint32_t len);
enum futil_file_err futil_file_type(const char *filename,
enum futil_file_type *type);
+/*
+ * Call the show() method on a buffer containing a specific file type.
+ * Returns zero on success. It's up to the caller to ensure that only valid
+ * file types are invoked.
+ */
+int futil_file_type_show(enum futil_file_type type,
+ const char *filename,
+ uint8_t *buf, uint32_t len);
+
+/*
+ * Call the sign() method on a buffer containing a specific file type.
+ * Returns zero on success. It's up to the caller to ensure that only valid
+ * file types are invoked.
+ */
+int futil_file_type_sign(enum futil_file_type type,
+ const char *filename,
+ uint8_t *buf, uint32_t len);
+
/* Declare the file_type functions. */
#define R_(FOO) \
enum futil_file_type FOO(uint8_t *buf, uint32_t len);