Unverified Commit 1bfb82d8 by Christian Brauner Committed by Stéphane Graber

confile: add getter for lxc.devttydir

parent b3389e8d
...@@ -65,6 +65,8 @@ static int set_config_tty(const char *, const char *, struct lxc_conf *); ...@@ -65,6 +65,8 @@ static int set_config_tty(const char *, const char *, struct lxc_conf *);
static int get_config_tty(struct lxc_container *, const char *, char *, int); static int get_config_tty(struct lxc_container *, const char *, char *, int);
static int set_config_ttydir(const char *, const char *, struct lxc_conf *); static int set_config_ttydir(const char *, const char *, struct lxc_conf *);
static int get_config_ttydir(struct lxc_container *, const char *, char *, int);
static int set_config_kmsg(const char *, const char *, struct lxc_conf *); static int set_config_kmsg(const char *, const char *, struct lxc_conf *);
static int set_config_lsm_aa_profile(const char *, const char *, struct lxc_conf *); static int set_config_lsm_aa_profile(const char *, const char *, struct lxc_conf *);
static int set_config_lsm_aa_incomplete(const char *, const char *, struct lxc_conf *); static int set_config_lsm_aa_incomplete(const char *, const char *, struct lxc_conf *);
...@@ -123,7 +125,7 @@ static struct lxc_config_t config[] = { ...@@ -123,7 +125,7 @@ static struct lxc_config_t config[] = {
{ "lxc.arch", set_config_personality, get_config_personality, NULL}, { "lxc.arch", set_config_personality, get_config_personality, NULL},
{ "lxc.pts", set_config_pts, get_config_pts, NULL}, { "lxc.pts", set_config_pts, get_config_pts, NULL},
{ "lxc.tty", set_config_tty, get_config_tty, NULL}, { "lxc.tty", set_config_tty, get_config_tty, NULL},
{ "lxc.devttydir", set_config_ttydir, NULL, NULL}, { "lxc.devttydir", set_config_ttydir, get_config_ttydir, NULL},
{ "lxc.kmsg", set_config_kmsg, NULL, NULL}, { "lxc.kmsg", set_config_kmsg, NULL, NULL},
{ "lxc.aa_profile", set_config_lsm_aa_profile, NULL, NULL}, { "lxc.aa_profile", set_config_lsm_aa_profile, NULL, NULL},
{ "lxc.aa_allow_incomplete", set_config_lsm_aa_incomplete, NULL, NULL}, { "lxc.aa_allow_incomplete", set_config_lsm_aa_incomplete, NULL, NULL},
...@@ -2773,8 +2775,6 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv, ...@@ -2773,8 +2775,6 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
return lxc_get_auto_mounts(c, retv, inlen); return lxc_get_auto_mounts(c, retv, inlen);
else if (strcmp(key, "lxc.mount") == 0) else if (strcmp(key, "lxc.mount") == 0)
v = c->fstab; v = c->fstab;
else if (strcmp(key, "lxc.devttydir") == 0)
v = c->ttydir;
else if (strcmp(key, "lxc.aa_profile") == 0) else if (strcmp(key, "lxc.aa_profile") == 0)
v = c->lsm_aa_profile; v = c->lsm_aa_profile;
else if (strcmp(key, "lxc.aa_allow_incomplete") == 0) else if (strcmp(key, "lxc.aa_allow_incomplete") == 0)
...@@ -3406,3 +3406,19 @@ static int get_config_tty(struct lxc_container *c, const char *key, char *retv, ...@@ -3406,3 +3406,19 @@ static int get_config_tty(struct lxc_container *c, const char *key, char *retv,
{ {
return lxc_get_conf_int(c->lxc_conf, retv, inlen, c->lxc_conf->tty); return lxc_get_conf_int(c->lxc_conf, retv, inlen, c->lxc_conf->tty);
} }
static inline int lxc_get_conf_str(char *retv, int inlen, char *value)
{
if (!value)
return 0;
if (retv && inlen >= strlen(value) + 1)
strncpy(retv, value, strlen(value) + 1);
return strlen(value);
}
static int get_config_ttydir(struct lxc_container *c, const char *key,
char *retv, int inlen)
{
return lxc_get_conf_str(retv, inlen, c->lxc_conf->ttydir);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment