From: Christian Brauner Date: Wed, 31 May 2017 05:28:05 +0000 (+0200) Subject: confile: add getter for lxc.mount.entry X-Git-Tag: lxc-2.1.0~110^2~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc9218487aca06ae41bcb4c56190ad30607fabec;p=thirdparty%2Flxc.git confile: add getter for lxc.mount.entry Signed-off-by: Christian Brauner --- diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 0b93c7023..201bf5137 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -101,6 +101,7 @@ static int set_config_logfile(const char *, const char *, struct lxc_conf *); static int get_config_logfile(struct lxc_container *, const char *, char *, int); static int set_config_mount(const char *, const char *, struct lxc_conf *); +static int get_config_mount(struct lxc_container *, const char *, char *, int); static int set_config_mount_auto(const char *, const char *, struct lxc_conf *); static int get_config_mount_auto(struct lxc_container *, const char *, char *, int); @@ -167,7 +168,7 @@ static struct lxc_config_t config[] = { { "lxc.id_map", set_config_idmaps, get_config_idmaps, NULL}, { "lxc.loglevel", set_config_loglevel, get_config_loglevel, NULL}, { "lxc.logfile", set_config_logfile, get_config_logfile, NULL}, - { "lxc.mount.entry", set_config_mount, NULL, NULL}, + { "lxc.mount.entry", set_config_mount, get_config_mount, NULL}, { "lxc.mount.auto", set_config_mount_auto, get_config_mount_auto, NULL}, { "lxc.mount", set_config_fstab, get_config_fstab, NULL}, { "lxc.rootfs.mount", set_config_rootfs_mount, NULL, NULL}, @@ -2764,22 +2765,6 @@ static int lxc_get_item_cap_keep(struct lxc_conf *c, char *retv, int inlen) return fulllen; } -static int lxc_get_mount_entries(struct lxc_conf *c, char *retv, int inlen) -{ - int len, fulllen = 0; - struct lxc_list *it; - - if (!retv) - inlen = 0; - else - memset(retv, 0, inlen); - - lxc_list_for_each(it, &c->mount_list) { - strprint(retv, inlen, "%s\n", (char *)it->elem); - } - return fulllen; -} - /* * lxc.network.0.XXX, where XXX can be: name, type, link, flags, type, * macvlan.mode, veth.pair, vlan, ipv4, ipv6, script.up, hwaddr, mtu, @@ -2912,9 +2897,7 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv, { const char *v = NULL; - if (strcmp(key, "lxc.mount.entry") == 0) - return lxc_get_mount_entries(c, retv, inlen); - else if (strcmp(key, "lxc.utsname") == 0) + if (strcmp(key, "lxc.utsname") == 0) v = c->utsname ? c->utsname->nodename : NULL; else if (strcmp(key, "lxc.console.logfile") == 0) v = c->console.log_path; @@ -3827,3 +3810,22 @@ static int get_config_mount_auto(struct lxc_container *c, const char *key, return fulllen; } + +static int get_config_mount(struct lxc_container *c, const char *key, + char *retv, int inlen) +{ + int len, fulllen = 0; + struct lxc_list *it; + + if (!retv) + inlen = 0; + else + memset(retv, 0, inlen); + + lxc_list_for_each(it, &c->lxc_conf->mount_list) + { + strprint(retv, inlen, "%s\n", (char *)it->elem); + } + + return fulllen; +}