confile: add getter for lxc.rootfs

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2017-05-31 07:33:27 +02:00
parent cc9218487a
commit 819114b6fb
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -1,6 +1,5 @@
/* /*
* lxc: linux Container library * lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2008 * (C) Copyright IBM Corp. 2007, 2008
* *
* Authors: * Authors:
@ -110,6 +109,8 @@ static int set_config_fstab(const char *, const char *, struct lxc_conf *);
static int get_config_fstab(struct lxc_container *, const char *, char *, int); static int get_config_fstab(struct lxc_container *, const char *, char *, int);
static int set_config_rootfs(const char *, const char *, struct lxc_conf *); static int set_config_rootfs(const char *, const char *, struct lxc_conf *);
static int get_config_rootfs(struct lxc_container *, const char *, char *, int);
static int set_config_rootfs_mount(const char *, const char *, struct lxc_conf *); static int set_config_rootfs_mount(const char *, const char *, struct lxc_conf *);
static int set_config_rootfs_options(const char *, const char *, struct lxc_conf *); static int set_config_rootfs_options(const char *, const char *, struct lxc_conf *);
static int set_config_rootfs_backend(const char *, const char *, struct lxc_conf *); static int set_config_rootfs_backend(const char *, const char *, struct lxc_conf *);
@ -174,7 +175,7 @@ static struct lxc_config_t config[] = {
{ "lxc.rootfs.mount", set_config_rootfs_mount, NULL, NULL}, { "lxc.rootfs.mount", set_config_rootfs_mount, NULL, NULL},
{ "lxc.rootfs.options", set_config_rootfs_options, NULL, NULL}, { "lxc.rootfs.options", set_config_rootfs_options, NULL, NULL},
{ "lxc.rootfs.backend", set_config_rootfs_backend, NULL, NULL}, { "lxc.rootfs.backend", set_config_rootfs_backend, NULL, NULL},
{ "lxc.rootfs", set_config_rootfs, NULL, NULL}, { "lxc.rootfs", set_config_rootfs, get_config_rootfs, NULL},
{ "lxc.pivotdir", set_config_pivotdir, NULL, NULL}, { "lxc.pivotdir", set_config_pivotdir, NULL, NULL},
{ "lxc.utsname", set_config_utsname, NULL, NULL}, { "lxc.utsname", set_config_utsname, NULL, NULL},
{ "lxc.hook.pre-start", set_config_hook, NULL, NULL}, { "lxc.hook.pre-start", set_config_hook, NULL, NULL},
@ -2909,8 +2910,6 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
v = c->rootfs.bdev_type; v = c->rootfs.bdev_type;
else if (strcmp(key, "lxc.rootfs.options") == 0) else if (strcmp(key, "lxc.rootfs.options") == 0)
v = c->rootfs.options; v = c->rootfs.options;
else if (strcmp(key, "lxc.rootfs") == 0)
v = c->rootfs.path;
else if (strcmp(key, "lxc.cap.drop") == 0) else if (strcmp(key, "lxc.cap.drop") == 0)
return lxc_get_item_cap_drop(c, retv, inlen); return lxc_get_item_cap_drop(c, retv, inlen);
else if (strcmp(key, "lxc.cap.keep") == 0) else if (strcmp(key, "lxc.cap.keep") == 0)
@ -3829,3 +3828,9 @@ static int get_config_mount(struct lxc_container *c, const char *key,
return fulllen; return fulllen;
} }
static int get_config_rootfs(struct lxc_container *c, const char *key,
char *retv, int inlen)
{
return lxc_get_conf_str(retv, inlen, c->lxc_conf->rootfs.path);
}