]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
add lxc.rootfs.mount config option
authorDaniel Lezcano <daniel.lezcano@free.fr>
Wed, 12 May 2010 21:44:28 +0000 (23:44 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 12 May 2010 21:44:28 +0000 (23:44 +0200)
Define lxc.rootfs.mount option in order to override the default
mount point for rootfs.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/conf.h
src/lxc/confile.c

index 14c931d36089117be6d7ad32b4e61f6de7c9446f..845126607a0d51386efd7b4e8154693a5e9e893d 100644 (file)
@@ -170,6 +170,7 @@ struct lxc_console {
  */
 struct lxc_rootfs {
        char *path;
+       char *mount;
        char *pivot;
 };
 
index dd9f2cbdab9e3f1c48fa22bc5d24ce4c3dd53e48..8c1b3ddd15f4084279930e521a4111591db73809 100644 (file)
@@ -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) {