X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=lib%2Fpb-protocol%2Fpb-protocol.c;h=d39c1c490e1a782bf5a8b9c176e7250b459a5979;hb=e596e8e66b014161116c207daa8d42cff849bfd2;hp=4a5c75a32437b1e4bd201eba7d5a760288ad55ad;hpb=e19c5fe83174de749843bb8486a0d12c25adcb82;p=petitboot diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 4a5c75a..d39c1c4 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -267,7 +267,8 @@ int pb_protocol_config_len(const struct config *config) unsigned int i, len; len = 4 /* config->autoboot_enabled */ + - 4 /* config->autoboot_timeout_sec */; + 4 /* config->autoboot_timeout_sec */ + + 4 /* config->safe_mode */; len += 4; for (i = 0; i < config->network.n_interfaces; i++) @@ -281,6 +282,8 @@ int pb_protocol_config_len(const struct config *config) len += 4; len += config->n_boot_priorities * 8; + len += 4 + optional_strlen(config->boot_device); + return len; } @@ -446,6 +449,9 @@ int pb_protocol_serialise_config(const struct config *config, *(uint32_t *)pos = __cpu_to_be32(config->autoboot_timeout_sec); pos += 4; + *(uint32_t *)pos = config->safe_mode; + pos += 4; + *(uint32_t *)pos = __cpu_to_be32(config->network.n_interfaces); pos += 4; for (i = 0; i < config->network.n_interfaces; i++) { @@ -860,6 +866,10 @@ int pb_protocol_deserialise_config(struct config *config, if (read_u32(&pos, &len, &config->autoboot_timeout_sec)) goto out; + if (read_u32(&pos, &len, &tmp)) + goto out; + config->safe_mode = !!tmp; + if (read_u32(&pos, &len, &config->network.n_interfaces)) goto out;