]> git.ozlabs.org Git - petitboot/blobdiff - lib/pb-protocol/pb-protocol.c
discover: Maintain a backlog of status updates
[petitboot] / lib / pb-protocol / pb-protocol.c
index 8bc8820d8f5833274a6f80322d2d476ccaf7d97d..65a1e93408d834d0449d458d0806e3ef50be66f6 100644 (file)
@@ -217,8 +217,9 @@ int pb_protocol_boot_len(const struct boot_command *boot)
 
 int pb_protocol_boot_status_len(const struct status *status)
 {
-       return  4 +
+       return  4 +     /* type */
                4 + optional_strlen(status->message) +
+               4 +     /* backlog */
                4;
 }
 
@@ -410,6 +411,9 @@ int pb_protocol_serialise_boot_status(const struct status *status,
 
        pos += pb_protocol_serialise_string(pos, status->message);
 
+       *(bool *)pos = __cpu_to_be32(status->backlog);
+       pos += sizeof(bool);
+
        assert(pos <= buf + buf_len);
        (void)buf_len;
 
@@ -847,6 +851,10 @@ int pb_protocol_deserialise_boot_status(struct status *status,
        if (read_string(status, &pos, &len, &status->message))
                goto out;
 
+       /* backlog */
+       status->backlog = *(bool *)pos;
+       pos += sizeof(status->backlog);
+
        rc = 0;
 
 out: