[lxc-devel] [PATCH 4/5] add lxc.rootfs.mount config option

Daniel Lezcano dlezcano at fr.ibm.com
Wed May 12 11:00:25 UTC 2010


From: Daniel Lezcano <daniel.lezcano at free.fr>

Define lxc.rootfs.mount option in order to override the default
mount point for rootfs.

Signed-off-by: Daniel Lezcano <dlezcano at fr.ibm.com>
---
 src/lxc/conf.h    |    1 +
 src/lxc/confile.c |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/lxc/conf.h b/src/lxc/conf.h
index 14c931d..8451266 100644
--- a/src/lxc/conf.h
+++ b/src/lxc/conf.h
@@ -170,6 +170,7 @@ struct lxc_console {
  */
 struct lxc_rootfs {
 	char *path;
+	char *mount;
 	char *pivot;
 };
 
diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index dd9f2cb..8c1b3dd 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -48,6 +48,7 @@ static int config_tty(const char *, char *, struct lxc_conf *);
 static int config_cgroup(const char *, char *, struct lxc_conf *);
 static int config_mount(const char *, char *, struct lxc_conf *);
 static int config_rootfs(const char *, char *, struct lxc_conf *);
+static int config_rootfs_mount(const char *, char *, struct lxc_conf *);
 static int config_pivotdir(const char *, char *, struct lxc_conf *);
 static int config_utsname(const char *, char *, struct lxc_conf *);
 static int config_network_type(const char *, char *, struct lxc_conf *);
@@ -77,6 +78,7 @@ static struct config config[] = {
 	{ "lxc.tty",                  config_tty                  },
 	{ "lxc.cgroup",               config_cgroup               },
 	{ "lxc.mount",                config_mount                },
+	{ "lxc.rootfs.mount",         config_rootfs_mount         },
 	{ "lxc.rootfs",               config_rootfs               },
 	{ "lxc.pivotdir",             config_pivotdir             },
 	{ "lxc.utsname",              config_utsname              },
@@ -652,6 +654,22 @@ static int config_rootfs(const char *key, char *value, struct lxc_conf *lxc_conf
 	return 0;
 }
 
+static int config_rootfs_mount(const char *key, char *value, struct lxc_conf *lxc_conf)
+{
+	if (strlen(value) >= MAXPATHLEN) {
+		ERROR("%s path is too long", value);
+		return -1;
+	}
+
+	lxc_conf->rootfs.mount = strdup(value);
+	if (!lxc_conf->rootfs.mount) {
+		SYSERROR("failed to duplicate string '%s'", value);
+		return -1;
+	}
+
+	return 0;
+}
+
 static int config_pivotdir(const char *key, char *value, struct lxc_conf *lxc_conf)
 {
 	if (strlen(value) >= MAXPATHLEN) {
-- 
1.6.3.3





More information about the lxc-devel mailing list