summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-07-25 09:49:37 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-07-28 13:50:36 +0800
commit37bece9c6354e8857dc3001d6fd245d8a733ef28 (patch)
tree3657a219063540a14a56969fccd6fbad165a9036 /lib
parent24a530d0b58f57f151ee6d3df9f747ae98ef759f (diff)
downloadpetitboot-37bece9c6354e8857dc3001d6fd245d8a733ef28.zip
petitboot-37bece9c6354e8857dc3001d6fd245d8a733ef28.tar.gz
config: Add lang member to config
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/pb-config/pb-config.c5
-rw-r--r--lib/pb-protocol/pb-protocol.c9
-rw-r--r--lib/types/types.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/lib/pb-config/pb-config.c b/lib/pb-config/pb-config.c
index d43a5ab..fbaa7cb 100644
--- a/lib/pb-config/pb-config.c
+++ b/lib/pb-config/pb-config.c
@@ -74,5 +74,10 @@ struct config *config_copy(void *ctx, const struct config *src)
else
dest->boot_device = NULL;
+ if (src->lang && strlen(src->lang))
+ dest->lang = talloc_strdup(dest, src->lang);
+ else
+ dest->lang = NULL;
+
return dest;
}
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index d39c1c4..c184719 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -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->lang);
+
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->lang);
+
assert(pos <= buf + buf_len);
(void)buf_len;
@@ -915,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:
diff --git a/lib/types/types.h b/lib/types/types.h
index 0333a02..5536e2a 100644
--- a/lib/types/types.h
+++ b/lib/types/types.h
@@ -126,6 +126,7 @@ struct config {
struct boot_priority *boot_priorities;
unsigned int n_boot_priorities;
char *boot_device;
+ char *lang;
};
#endif /* _TYPES_H */
OpenPOWER on IntegriCloud