lxc_config_define_add() and lxc_config_define_load() define
the interface to load a list of KEY=VAL buffers in the configuration

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
 src/lxc/confile.c |   33 +++++++++++++++++++++++++++++++++
 src/lxc/confile.h |    5 ++++-
 2 files changed, 37 insertions(+), 1 deletion(-)

Index: lxc/src/lxc/confile.c
===================================================================
--- lxc.orig/src/lxc/confile.c
+++ lxc/src/lxc/confile.c
@@ -671,3 +671,36 @@ int lxc_config_read(const char *file, st
 	return lxc_file_for_each_line(file, parse_line, buffer,
 				      sizeof(buffer), conf);
 }
+
+int lxc_config_define_add(struct lxc_list *defines, char* arg)
+{
+	struct lxc_list *dent;
+
+	dent = malloc(sizeof(struct lxc_list));
+	if (!dent)
+		return -1;
+
+	dent->elem = arg;
+	lxc_list_add_tail(defines, dent);
+	return 0;
+}
+
+char* lxc_config_define_load(struct lxc_list *defines,
+	struct lxc_conf *conf)
+{
+	struct lxc_list *it;
+	int ret = 0;
+
+	lxc_list_for_each(it, defines) {
+		ret = lxc_config_readline(it->elem, conf);
+		if (ret)
+			break;
+	}
+
+	lxc_list_for_each(it, defines) {
+		lxc_list_del(it);
+		free(it);
+	}
+
+	return ret;
+}
Index: lxc/src/lxc/confile.h
===================================================================
--- lxc.orig/src/lxc/confile.h
+++ lxc/src/lxc/confile.h
@@ -22,8 +22,11 @@
  */
 
 struct lxc_conf;
+struct lxc_list;
 
 extern int lxc_config_read(const char *file, struct lxc_conf *conf);
 extern int lxc_config_readline(char *buffer, struct lxc_conf *conf);
 
-
+extern int lxc_config_define_add(struct lxc_list *defines, char* arg);
+extern char *lxc_config_define_load(struct lxc_list *defines,
+				    struct lxc_conf *conf);



