4 + optional_strlen(boot->console);
}
-int pb_protocol_boot_status_len(const struct boot_status *status)
+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;
}
struct interface_info *if_info = sysinfo->interfaces[i];
len += 4 + if_info->hwaddr_size +
4 + optional_strlen(if_info->name) +
- sizeof(if_info->link);
+ sizeof(if_info->link) +
+ 4 + optional_strlen(if_info->address);
}
for (i = 0; i < sysinfo->n_blockdevs; i++) {
return 0;
}
-int pb_protocol_serialise_boot_status(const struct boot_status *status,
+int pb_protocol_serialise_boot_status(const struct status *status,
char *buf, int buf_len)
{
char *pos = buf;
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;
*(bool *)pos = if_info->link;
pos += sizeof(bool);
+
+ pos += pb_protocol_serialise_string(pos, if_info->address);
}
*(uint32_t *)pos = __cpu_to_be32(sysinfo->n_blockdevs);
return rc;
}
-int pb_protocol_deserialise_boot_status(struct boot_status *status,
+int pb_protocol_deserialise_boot_status(struct status *status,
const struct pb_protocol_message *message)
{
unsigned int len;
status->type = __be32_to_cpu(*(uint32_t *)(pos));
switch (status->type) {
- case BOOT_STATUS_ERROR:
- case BOOT_STATUS_INFO:
+ case STATUS_ERROR:
+ case STATUS_INFO:
break;
default:
goto out;
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;
if_info->link = *(bool *)pos;
pos += sizeof(if_info->link);
+ if (read_string(if_info, &pos, &len, &if_info->address))
+ goto out;
+
sysinfo->interfaces[i] = if_info;
}