4 + optional_strlen(sysinfo->identifier) +
4 + 4;
+ len += 4;
+ for (i = 0; i < sysinfo->n_primary; i++)
+ len += 4 + optional_strlen(sysinfo->platform_primary[i]);
+ len += 4;
+ for (i = 0; i < sysinfo->n_other; i++)
+ len += 4 + optional_strlen(sysinfo->platform_other[i]);
+
+ len += 4;
+ for (i = 0; i < sysinfo->n_bmc_current; i++)
+ len += 4 + optional_strlen(sysinfo->bmc_current[i]);
+ len += 4;
+ for (i = 0; i < sysinfo->n_bmc_golden; i++)
+ len += 4 + optional_strlen(sysinfo->bmc_golden[i]);
+
for (i = 0; i < sysinfo->n_interfaces; i++) {
struct interface_info *if_info = sysinfo->interfaces[i];
len += 4 + if_info->hwaddr_size +
pos += pb_protocol_serialise_string(pos, sysinfo->type);
pos += pb_protocol_serialise_string(pos, sysinfo->identifier);
+ *(uint32_t *)pos = __cpu_to_be32(sysinfo->n_primary);
+ pos += sizeof(uint32_t);
+ for (i = 0; i < sysinfo->n_primary; i++)
+ pos += pb_protocol_serialise_string(pos, sysinfo->platform_primary[i]);
+
+ *(uint32_t *)pos = __cpu_to_be32(sysinfo->n_other);
+ pos += sizeof(uint32_t);
+ for (i = 0; i < sysinfo->n_other; i++)
+ pos += pb_protocol_serialise_string(pos, sysinfo->platform_other[i]);
+
+ *(uint32_t *)pos = __cpu_to_be32(sysinfo->n_bmc_current);
+ pos += sizeof(uint32_t);
+ for (i = 0; i < sysinfo->n_bmc_current; i++)
+ pos += pb_protocol_serialise_string(pos, sysinfo->bmc_current[i]);
+
+ *(uint32_t *)pos = __cpu_to_be32(sysinfo->n_bmc_golden);
+ pos += sizeof(uint32_t);
+ for (i = 0; i < sysinfo->n_bmc_golden; i++)
+ pos += pb_protocol_serialise_string(pos, sysinfo->bmc_golden[i]);
+
*(uint32_t *)pos = __cpu_to_be32(sysinfo->n_interfaces);
pos += sizeof(uint32_t);
pos += pb_protocol_serialise_string(pos, bd_info->mountpoint);
}
- memcpy(pos, sysinfo->bmc_mac, HWADDR_SIZE);
+ if (sysinfo->bmc_mac)
+ memcpy(pos, sysinfo->bmc_mac, HWADDR_SIZE);
+ else
+ memset(pos, 0, HWADDR_SIZE);
pos += HWADDR_SIZE;
assert(pos <= buf + buf_len);
unsigned int len, i;
const char *pos;
int rc = -1;
+ char *tmp;
len = message->payload_len;
pos = message->payload;
if (read_string(sysinfo, &pos, &len, &sysinfo->identifier))
goto out;
+ /* Platform version strings for openpower platforms */
+ if (read_u32(&pos, &len, &sysinfo->n_primary))
+ goto out;
+ sysinfo->platform_primary = talloc_array(sysinfo, char *,
+ sysinfo->n_primary);
+ for (i = 0; i < sysinfo->n_primary; i++) {
+ if (read_string(sysinfo, &pos, &len, &tmp))
+ goto out;
+ sysinfo->platform_primary[i] = talloc_strdup(sysinfo, tmp);
+ }
+
+ if (read_u32(&pos, &len, &sysinfo->n_other))
+ goto out;
+ sysinfo->platform_other = talloc_array(sysinfo, char *,
+ sysinfo->n_other);
+ for (i = 0; i < sysinfo->n_other; i++) {
+ if (read_string(sysinfo, &pos, &len, &tmp))
+ goto out;
+ sysinfo->platform_other[i] = talloc_strdup(sysinfo, tmp);
+ }
+
+ /* BMC version strings for openpower platforms */
+ if (read_u32(&pos, &len, &sysinfo->n_bmc_current))
+ goto out;
+ sysinfo->bmc_current = talloc_array(sysinfo, char *,
+ sysinfo->n_bmc_current);
+ for (i = 0; i < sysinfo->n_bmc_current; i++) {
+ if (read_string(sysinfo, &pos, &len, &tmp))
+ goto out;
+ sysinfo->bmc_current[i] = talloc_strdup(sysinfo, tmp);
+ }
+
+ if (read_u32(&pos, &len, &sysinfo->n_bmc_golden))
+ goto out;
+ sysinfo->bmc_golden = talloc_array(sysinfo, char *,
+ sysinfo->n_bmc_golden);
+ for (i = 0; i < sysinfo->n_bmc_golden; i++) {
+ if (read_string(sysinfo, &pos, &len, &tmp))
+ goto out;
+ sysinfo->bmc_golden[i] = talloc_strdup(sysinfo, tmp);
+ }
+
/* number of interfaces */
if (read_u32(&pos, &len, &sysinfo->n_interfaces))
goto out;