]> git.ozlabs.org Git - petitboot/commitdiff
config: Add lang member to config
authorJeremy Kerr <jk@ozlabs.org>
Fri, 25 Jul 2014 01:49:37 +0000 (09:49 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 28 Jul 2014 05:50:36 +0000 (13:50 +0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/platform.c
lib/pb-config/pb-config.c
lib/pb-protocol/pb-protocol.c
lib/types/types.h

index 93f25c357ad1ddbb16675d799be85d7421a185b2..11e18f8f0157b62f3e8ad2e3bfb2af5c74f727e5 100644 (file)
@@ -81,6 +81,8 @@ static void dump_config(struct config *config)
                pb_log(" %10s: %d\n", device_type_name(prio->type),
                                        prio->priority);
        }
                pb_log(" %10s: %d\n", device_type_name(prio->type),
                                        prio->priority);
        }
+
+       pb_log(" language: %s\n", config->lang ?: "");
 }
 
 void config_set_defaults(struct config *config)
 }
 
 void config_set_defaults(struct config *config)
@@ -93,6 +95,7 @@ void config_set_defaults(struct config *config)
        config->network.dns_servers = NULL;
        config->network.n_dns_servers = 0;
        config->boot_device = NULL;
        config->network.dns_servers = NULL;
        config->network.n_dns_servers = 0;
        config->boot_device = NULL;
+       config->lang = NULL;
 
        config->n_boot_priorities = 2;
        config->boot_priorities = talloc_array(config, struct boot_priority,
 
        config->n_boot_priorities = 2;
        config->boot_priorities = talloc_array(config, struct boot_priority,
index d43a5abba718bd1eedab88149b4d4aeaf6063589..fbaa7cb908b04000f7ae8958516aff981183e003 100644 (file)
@@ -74,5 +74,10 @@ struct config *config_copy(void *ctx, const struct config *src)
        else
                dest->boot_device = NULL;
 
        else
                dest->boot_device = NULL;
 
+       if (src->lang && strlen(src->lang))
+               dest->lang = talloc_strdup(dest, src->lang);
+       else
+               dest->lang = NULL;
+
        return dest;
 }
        return dest;
 }
index d39c1c490e1a782bf5a8b9c176e7250b459a5979..c184719be85fad32eab5dc3fe7ec48de4411f1a8 100644 (file)
@@ -284,6 +284,8 @@ int pb_protocol_config_len(const struct config *config)
 
        len += 4 + optional_strlen(config->boot_device);
 
 
        len += 4 + optional_strlen(config->boot_device);
 
+       len += 4 + optional_strlen(config->lang);
+
        return len;
 }
 
        return len;
 }
 
@@ -480,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->boot_device);
 
+       pos += pb_protocol_serialise_string(pos, config->lang);
+
        assert(pos <= buf + buf_len);
        (void)buf_len;
 
        assert(pos <= buf + buf_len);
        (void)buf_len;
 
@@ -915,6 +919,11 @@ int pb_protocol_deserialise_config(struct config *config,
 
        config->boot_device = str;
 
 
        config->boot_device = str;
 
+       if (read_string(config, &pos, &len, &str))
+               goto out;
+
+       config->lang = str;
+
        rc = 0;
 
 out:
        rc = 0;
 
 out:
index 0333a02d9aa385b4eb121574813d85e862120bfd..5536e2a912e48c6df3025f6d6e288bb785257830 100644 (file)
@@ -126,6 +126,7 @@ struct config {
        struct boot_priority    *boot_priorities;
        unsigned int            n_boot_priorities;
        char                    *boot_device;
        struct boot_priority    *boot_priorities;
        unsigned int            n_boot_priorities;
        char                    *boot_device;
+       char                    *lang;
 };
 
 #endif /* _TYPES_H */
 };
 
 #endif /* _TYPES_H */