]> git.ozlabs.org Git - petitboot/blobdiff - lib/pb-protocol/pb-protocol.c
ui/ncurses: Reset console options on boot
[petitboot] / lib / pb-protocol / pb-protocol.c
index 41707da09ab0d7345c8d0a0a2d2f9d1b48f43517..7c563c8e0ad17de54e8dd1ad86ae786949a11422 100644 (file)
@@ -223,7 +223,7 @@ int pb_protocol_boot_status_len(const struct status *status)
        return  4 +     /* type */
                4 + optional_strlen(status->message) +
                4 +     /* backlog */
-               4;
+               4;      /* boot_active */
 }
 
 int pb_protocol_system_info_len(const struct system_info *sysinfo)
@@ -457,6 +457,9 @@ int pb_protocol_serialise_boot_status(const struct status *status,
        *(bool *)pos = __cpu_to_be32(status->backlog);
        pos += sizeof(bool);
 
+       *(bool *)pos = __cpu_to_be32(status->boot_active);
+       pos += sizeof(bool);
+
        assert(pos <= buf + buf_len);
        (void)buf_len;
 
@@ -725,7 +728,7 @@ int pb_protocol_write_message(int fd, struct pb_protocol_message *message)
        if (!total_len)
                return 0;
 
-       pb_log("%s: failed: %s\n", __func__, strerror(errno));
+       pb_log_fn("failed: %s\n", strerror(errno));
        return -1;
 }
 
@@ -735,7 +738,7 @@ struct pb_protocol_message *pb_protocol_create_message(void *ctx,
        struct pb_protocol_message *message;
 
        if (payload_len > PB_PROTOCOL_MAX_PAYLOAD_SIZE) {
-               pb_log("%s: payload too big %u/%u\n", __func__, payload_len,
+               pb_log_fn("payload too big %u/%u\n", payload_len,
                        PB_PROTOCOL_MAX_PAYLOAD_SIZE);
                return NULL;
        }
@@ -766,7 +769,7 @@ struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd)
        m.action = __be32_to_cpu(m.action);
 
        if (m.payload_len > PB_PROTOCOL_MAX_PAYLOAD_SIZE) {
-               pb_log("%s: payload too big %u/%u\n", __func__, m.payload_len,
+               pb_log_fn("payload too big %u/%u\n", m.payload_len,
                        PB_PROTOCOL_MAX_PAYLOAD_SIZE);
                return NULL;
        }
@@ -779,7 +782,7 @@ struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd)
 
                if (rc <= 0) {
                        talloc_free(message);
-                       pb_log("%s: failed (%u): %s\n", __func__, len,
+                       pb_log_fn("failed (%u): %s\n", len,
                                strerror(errno));
                        return NULL;
                }
@@ -952,6 +955,10 @@ int pb_protocol_deserialise_boot_status(struct status *status,
        status->backlog = *(bool *)pos;
        pos += sizeof(status->backlog);
 
+       /* boot_active */
+       status->boot_active = *(bool *)pos;
+       pos += sizeof(status->boot_active);
+
        rc = 0;
 
 out: