From 87017f0478536fcb927010618be483a5efe9260c Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Thu, 28 Jun 2018 14:45:19 +1000 Subject: ui/ncurses: Keep track of the default boot option Keep track of the default boot option, and prefix its display name with a '(*)' to point it out to the user. This avoids having to authenticate with pb-discover even if only booting the default option. Signed-off-by: Samuel Mendoza-Jonas --- lib/pb-protocol/pb-protocol.c | 6 ++++++ lib/types/types.h | 1 + 2 files changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 5de382d..d8771fc 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -204,6 +204,7 @@ int pb_protocol_boot_option_len(const struct boot_option *opt) 4 + optional_strlen(opt->boot_args) + 4 + optional_strlen(opt->args_sig_file) + sizeof(opt->is_default) + + sizeof(opt->is_autoboot_default) + sizeof(opt->type); } @@ -434,6 +435,8 @@ int pb_protocol_serialise_boot_option(const struct boot_option *opt, *(bool *)pos = opt->is_default; pos += sizeof(bool); + *(bool *)pos = opt->is_autoboot_default; + pos += sizeof(bool); *(uint32_t *)pos = __cpu_to_be32(opt->type); pos += 4; @@ -925,6 +928,9 @@ int pb_protocol_deserialise_boot_option(struct boot_option *opt, opt->is_default = *(bool *)(pos); pos += sizeof(bool); len -= sizeof(bool); + opt->is_autoboot_default = *(bool *)(pos); + pos += sizeof(bool); + len -= sizeof(bool); if (read_u32(&pos, &len, &opt->type)) return -1; diff --git a/lib/types/types.h b/lib/types/types.h index f5392c8..39760d9 100644 --- a/lib/types/types.h +++ b/lib/types/types.h @@ -54,6 +54,7 @@ struct boot_option { char *boot_args; char *args_sig_file; bool is_default; + bool is_autoboot_default; struct list_item list; -- cgit v1.2.1