summaryrefslogtreecommitdiff
path: root/futility/futility.h
diff options
context:
space:
mode:
Diffstat (limited to 'futility/futility.h')
-rw-r--r--futility/futility.h39
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. */