]> git.ozlabs.org Git - petitboot/blobdiff - lib/pb-protocol/pb-protocol.c
ui/ncurses: Keep track of the default boot option
[petitboot] / lib / pb-protocol / pb-protocol.c
index 5de382d2215bae22c216c1e3424a6147b308c7b2..d8771fcb9493296be9b879c1f841d4aa681a6273 100644 (file)
@@ -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;