diff options
author | Bill Richardson <wfrichar@chromium.org> | 2015-03-26 15:31:54 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-03-31 06:28:05 +0000 |
commit | 35c69cc159af325261a1365cce28f6ecf106307f (patch) | |
tree | 7e71d18af8d4eec7bfc1d38ad3911bdc345947d7 /futility/file_type.h | |
parent | 45ecc3d44746531ab6792442dc0b2a71f5a712f0 (diff) | |
download | vboot-35c69cc159af325261a1365cce28f6ecf106307f.tar.gz |
futility: put the recognizer functions in file_type.inc
This is preparation for a refactoring of how files are traversed.
file_type.inc will specify functions to recognize, show, or sign
each type of file.
This change puts the recognizer functions in file_type.inc, but
just stubs out the show and sign commands.
BUG=chromium:231574
BRANCH=none
TEST=make runtests
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: I1596a21319a8fb1182537abdf9be0196bef4b84b
Reviewed-on: https://chromium-review.googlesource.com/262893
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'futility/file_type.h')
-rw-r--r-- | futility/file_type.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/futility/file_type.h b/futility/file_type.h index 47b40992..58e14383 100644 --- a/futility/file_type.h +++ b/futility/file_type.h @@ -8,7 +8,8 @@ /* What type of things do I know how to handle? */ enum futil_file_type { -#define FILE_TYPE(A, B, C) FILE_TYPE_ ## A, + FILE_TYPE_UNKNOWN, +#define FILE_TYPE(A, B, C, D, E, F) FILE_TYPE_ ## A, #include "file_type.inc" #undef FILE_TYPE NUM_FILE_TYPES @@ -16,16 +17,14 @@ enum futil_file_type { /* Short name for file types */ const char * const futil_file_type_name(enum futil_file_type type); + /* Description of file type */ const char * const futil_file_type_desc(enum futil_file_type type); -/* Name to enum. Returns true on success. */ -int futil_file_str_to_type(const char *str, enum futil_file_type *tptr); - /* Print the list of type names and exit with the given value. */ void print_file_types_and_exit(int retval); -/* Lookup an type by name. Return true on success */ +/* Lookup a type by name. Return true on success */ int futil_str_to_file_type(const char *str, enum futil_file_type *type); /* @@ -40,13 +39,17 @@ 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); -/* Routines to identify particular file types. */ -enum futil_file_type recognize_bios_image(uint8_t *buf, uint32_t len); -enum futil_file_type recognize_gbb(uint8_t *buf, uint32_t len); -enum futil_file_type recognize_vblock1(uint8_t *buf, uint32_t len); -enum futil_file_type recognize_gpt(uint8_t *buf, uint32_t len); -enum futil_file_type recognize_vb1_key(uint8_t *buf, uint32_t len); -enum futil_file_type recognize_vb2_key(uint8_t *buf, uint32_t len); -enum futil_file_type recognize_pem(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); +#define S_(FOO) \ + int FOO(const char *name, uint8_t *buf, uint32_t len, void *data); +#define NONE +#define FILE_TYPE(A, B, C, D, E, F) D E F +#include "file_type.inc" +#undef FILE_TYPE +#undef NONE +#undef S_ +#undef R_ #endif /* VBOOT_REFERENCE_FUTILITY_FILE_TYPE_H_ */ |