]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: add clearer for lxc.rootfs
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 31 May 2017 15:46:06 +0000 (17:46 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 31 May 2017 15:46:51 +0000 (17:46 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 7e7717d6fb550edb421f91c86e2706eaf32b81be..82fdcedfabbd362c442482e32c248858c86f9caf 100644 (file)
@@ -123,9 +123,6 @@ static int set_config_fstab(const char *, const char *, struct lxc_conf *);
 static int get_config_fstab(const char *, char *, int, struct lxc_conf *);
 static int clr_config_fstab(const char *, struct lxc_conf *);
 
-static int set_config_rootfs(const char *, const char *, struct lxc_conf *);
-static int get_config_rootfs(const char *, char *, int, struct lxc_conf *);
-
 static int set_config_rootfs_mount(const char *, const char *, struct lxc_conf *);
 static int get_config_rootfs_mount(const char *, char *, int, struct lxc_conf *);
 
@@ -135,6 +132,10 @@ static int get_config_rootfs_options(const char *, char *, int, struct lxc_conf
 static int set_config_rootfs_backend(const char *, const char *, struct lxc_conf *);
 static int get_config_rootfs_backend(const char *, char *, int, struct lxc_conf *);
 
+static int set_config_rootfs(const char *, const char *, struct lxc_conf *);
+static int get_config_rootfs(const char *, char *, int, struct lxc_conf *);
+static int clr_config_rootfs(const char *, struct lxc_conf *);
+
 static int set_config_pivotdir(const char *, const char *, struct lxc_conf *);
 static int get_config_pivotdir(const char *, char *, int, struct lxc_conf *);
 
@@ -246,7 +247,7 @@ static struct lxc_config_t config[] = {
        { "lxc.rootfs.mount",         set_config_rootfs_mount,         get_config_rootfs_mount,      NULL },
        { "lxc.rootfs.options",       set_config_rootfs_options,       get_config_rootfs_options,    NULL },
        { "lxc.rootfs.backend",       set_config_rootfs_backend,       get_config_rootfs_backend,    NULL },
-       { "lxc.rootfs",               set_config_rootfs,               get_config_rootfs,            NULL },
+       { "lxc.rootfs",               set_config_rootfs,               get_config_rootfs,            clr_config_rootfs, },
        { "lxc.pivotdir",             set_config_pivotdir,             get_config_pivotdir,          NULL },
        { "lxc.utsname",              set_config_utsname,              get_config_utsname,           NULL },
        { "lxc.hook.pre-start",       set_config_hooks,                get_config_hooks,             NULL },
@@ -2806,10 +2807,6 @@ int lxc_clear_config_item(struct lxc_conf *c, const char *key)
        } else if (strcmp(key, "lxc.autodev") == 0) {
                c->autodev = 1;
 
-       } else if (strcmp(key, "lxc.rootfs") == 0) {
-               free(c->rootfs.path);
-               c->rootfs.path = NULL;
-
        } else if (strcmp(key, "lxc.rootfs.mount") == 0) {
                free(c->rootfs.mount);
                c->rootfs.mount = NULL;
@@ -4137,3 +4134,11 @@ static inline int clr_config_fstab(const char *key, struct lxc_conf *c)
        c->fstab = NULL;
        return 0;
 }
+
+static inline int clr_config_rootfs(const char *key, struct lxc_conf *c)
+{
+       free(c->rootfs.path);
+       c->rootfs.path = NULL;
+       return 0;
+}
+