Skip to content

Commit

Permalink
confile: add getter for lxc.mount
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner authored and stgraber committed Jul 14, 2017
1 parent 9b74217 commit 91e694c
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/lxc/confile.c
Expand Up @@ -92,8 +92,12 @@ 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 set_config_mount_auto(const char *, const char *, struct lxc_conf *);

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 set_config_rootfs(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 *);
Expand Down Expand Up @@ -152,7 +156,7 @@ static struct lxc_config_t config[] = {
{ "lxc.logfile", set_config_logfile, get_config_logfile, NULL},
{ "lxc.mount.entry", set_config_mount, NULL, NULL},
{ "lxc.mount.auto", set_config_mount_auto, NULL, NULL},
{ "lxc.mount", set_config_fstab, NULL, NULL},
{ "lxc.mount", set_config_fstab, get_config_fstab, NULL},
{ "lxc.rootfs.mount", set_config_rootfs_mount, NULL, NULL},
{ "lxc.rootfs.options", set_config_rootfs_options, NULL, NULL},
{ "lxc.rootfs.backend", set_config_rootfs_backend, NULL, NULL},
Expand Down Expand Up @@ -1409,12 +1413,18 @@ static int set_config_lsm_se_context(const char *key, const char *value,
}

static int set_config_logfile(const char *key, const char *value,
struct lxc_conf *c)
struct lxc_conf *c)
{
int ret;

// store these values in the lxc_conf, and then try to set for
// actual current logging.
if (config_value_empty(value)) {
free(c->logfile);
c->logfile = NULL;
return 0;
}

/* Store these values in the lxc_conf, and then try to set for actual
* current logging. */
ret = set_config_path_item(&c->logfile, value);
if (ret == 0)
ret = lxc_log_set_file(&c->logfd, c->logfile);
Expand Down Expand Up @@ -2707,8 +2717,6 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
return lxc_get_mount_entries(c, retv, inlen);
else if (strcmp(key, "lxc.mount.auto") == 0)
return lxc_get_auto_mounts(c, retv, inlen);
else if (strcmp(key, "lxc.mount") == 0)
v = c->fstab;
else if (strcmp(key, "lxc.utsname") == 0)
v = c->utsname ? c->utsname->nodename : NULL;
else if (strcmp(key, "lxc.console.logfile") == 0)
Expand Down Expand Up @@ -3467,3 +3475,9 @@ static int get_config_logfile(struct lxc_container *c, const char *key,
{
return lxc_get_conf_str(retv, inlen, c->lxc_conf->logfile);
}

static int get_config_fstab(struct lxc_container *c, const char *key,
char *retv, int inlen)
{
return lxc_get_conf_str(retv, inlen, c->lxc_conf->fstab);
}

0 comments on commit 91e694c

Please sign in to comment.