diff options
author | Bill Richardson <wfrichar@chromium.org> | 2015-02-05 12:36:15 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-02-28 00:56:13 +0000 |
commit | 1eae873b6194db25781233d7a4aaee6a34160eec (patch) | |
tree | ce7ce14d2a62beb97fce1772ea2f53920bdbd2b3 /futility/futility.h | |
parent | 822120106c963b43c3d303a791f8dd8731d0888e (diff) | |
download | vboot-stabilize-6842.B.tar.gz |
futility: Add global args to specify vboot API and formatstabilize-6842.Bstabilize-6835.B
The host-side futility tool will need to support all extant vboot
implementations. Some legacy futility commands only support the
original vb1 format, but others ("show" or "sign", for example)
may need to be instructed which formats to expect or emit.
This change adds some global args to specify the preferred
formats. It also cleans up a few [unused AFAICT] one-letter args
to avoid conflicts.
BUG=chromium:231574
BRANCH=none
TEST=make runtests
Nothing makes use of this yet, except the "help" command.
Change-Id: Ib79fa12af72b8860b9494e5d9e90b9572c006107
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/246765
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'futility/futility.h')
-rw-r--r-- | futility/futility.h | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/futility/futility.h b/futility/futility.h index 5f9a5b78..550e381e 100644 --- a/futility/futility.h +++ b/futility/futility.h @@ -17,21 +17,48 @@ /* Version string (autogenerated) */ extern const char futility_version[]; +/* Bitfields indicating the struct/format versions supported by a command */ +enum vboot_version { + /* + * v1.0 is the original structs used since the dawn of time. + * v2.0 can verify the firmware in smaller chunks, but there's + * no difference in the on-device structs, so it's only + * meaningful for the firmware API. Futility doesn't care. + */ + VBOOT_VERSION_1_0 = 0x00000001, + + /* + * v2.1 uses new and different structs, and is what v2.0 would have + * been if someone hadn't started using it before it was ready. + */ + VBOOT_VERSION_2_1 = 0x00000002, + + /* + * Everything we know about to date. + */ + VBOOT_VERSION_ALL = 0x00000003, +}; + +/* What's our preferred API & data format? */ +enum vboot_version vboot_version; + /* Here's a structure to define the commands that futility implements. */ struct futil_cmd_t { const char *const name; int (*const handler) (int argc, char **argv); + enum vboot_version version; const char *const shorthelp; void (*longhelp) (const char *cmd); }; /* Macro to define a command */ -#define DECLARE_FUTIL_COMMAND(NAME, HANDLER, SHORTHELP, LONGHELP) \ - const struct futil_cmd_t __cmd_##NAME = { \ - .name = #NAME, \ - .handler = HANDLER, \ - .shorthelp = SHORTHELP, \ - .longhelp = LONGHELP, \ +#define DECLARE_FUTIL_COMMAND(NAME, HANDLER, VERSION, SHORTHELP, LONGHELP) \ + const struct futil_cmd_t __cmd_##NAME = { \ + .name = #NAME, \ + .handler = HANDLER, \ + .version = VERSION, \ + .shorthelp = SHORTHELP, \ + .longhelp = LONGHELP, \ } /* This is the list of pointers to all commands. */ |