]> git.ozlabs.org Git - petitboot/blobdiff - lib/pb-protocol/pb-protocol.c
config: Add lang member to config
[petitboot] / lib / pb-protocol / pb-protocol.c
index 67e1f9e91a04dbf52e3ffebecc0a2371feca35a4..c184719be85fad32eab5dc3fe7ec48de4411f1a8 100644 (file)
@@ -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++)
@@ -283,6 +284,8 @@ int pb_protocol_config_len(const struct config *config)
 
        len += 4 + optional_strlen(config->boot_device);
 
+       len += 4 + optional_strlen(config->lang);
+
        return len;
 }
 
@@ -448,6 +451,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++) {
@@ -476,6 +482,8 @@ int pb_protocol_serialise_config(const struct config *config,
 
        pos += pb_protocol_serialise_string(pos, config->boot_device);
 
+       pos += pb_protocol_serialise_string(pos, config->lang);
+
        assert(pos <= buf + buf_len);
        (void)buf_len;
 
@@ -862,6 +870,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;
 
@@ -907,6 +919,11 @@ int pb_protocol_deserialise_config(struct config *config,
 
        config->boot_device = str;
 
+       if (read_string(config, &pos, &len, &str))
+               goto out;
+
+       config->lang = str;
+
        rc = 0;
 
 out: