X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=lib%2Fpb-protocol%2Fpb-protocol.c;h=65a1e93408d834d0449d458d0806e3ef50be66f6;hp=1e72d19338eba3405f95ee842b6e1ee23d1739e0;hb=75c97cfd449b2bac8e61af1017a83bdf43f5e8fe;hpb=4b06a4645e19830581505a675075773adc0857c2 diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 1e72d19..65a1e93 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -217,9 +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 + optional_strlen(status->detail) + + 4 + /* backlog */ 4; } @@ -410,10 +410,9 @@ int pb_protocol_serialise_boot_status(const struct status *status, pos += sizeof(uint32_t); pos += pb_protocol_serialise_string(pos, status->message); - pos += pb_protocol_serialise_string(pos, status->detail); - *(uint32_t *)pos = __cpu_to_be32(status->type); - pos += sizeof(uint32_t); + *(bool *)pos = __cpu_to_be32(status->backlog); + pos += sizeof(bool); assert(pos <= buf + buf_len); (void)buf_len; @@ -848,22 +847,13 @@ int pb_protocol_deserialise_boot_status(struct status *status, pos += sizeof(uint32_t); len -= sizeof(uint32_t); - /* message and detail strings */ + /* message string */ if (read_string(status, &pos, &len, &status->message)) goto out; - if (read_string(status, &pos, &len, &status->detail)) - goto out; - - /* and finally, progress */ - if (len < sizeof(uint32_t)) - goto out; - - status->progress = __be32_to_cpu(*(uint32_t *)(pos)); - - /* clamp to 100% */ - if (status->progress > 100) - status->progress = 100; + /* backlog */ + status->backlog = *(bool *)pos; + pos += sizeof(status->backlog); rc = 0;