confile: add getter for lxc.utsname

parent b87574e7
......@@ -124,6 +124,8 @@ static int set_config_pivotdir(const char *, const char *, struct lxc_conf *);
static int get_config_pivotdir(struct lxc_container *, const char *, char *, int);
static int set_config_utsname(const char *, const char *, struct lxc_conf *);
static int get_config_utsname(struct lxc_container *, const char *, char *, int);
static int set_config_hook(const char *, const char *, struct lxc_conf *lxc_conf);
static int set_config_network(const char *, const char *, struct lxc_conf *);
static int set_config_network_type(const char *, const char *, struct lxc_conf *);
......@@ -185,7 +187,7 @@ static struct lxc_config_t config[] = {
{ "lxc.rootfs.backend", set_config_rootfs_backend, get_config_rootfs_backend, NULL},
{ "lxc.rootfs", set_config_rootfs, get_config_rootfs, NULL},
{ "lxc.pivotdir", set_config_pivotdir, get_config_pivotdir, NULL},
{ "lxc.utsname", set_config_utsname, NULL, NULL},
{ "lxc.utsname", set_config_utsname, get_config_utsname, NULL},
{ "lxc.hook.pre-start", set_config_hook, NULL, NULL},
{ "lxc.hook.pre-mount", set_config_hook, NULL, NULL},
{ "lxc.hook.mount", set_config_hook, NULL, NULL},
......@@ -2906,9 +2908,7 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
{
const char *v = NULL;
if (strcmp(key, "lxc.utsname") == 0)
v = c->utsname ? c->utsname->nodename : NULL;
else if (strcmp(key, "lxc.console.logfile") == 0)
if (strcmp(key, "lxc.console.logfile") == 0)
v = c->console.log_path;
else if (strcmp(key, "lxc.console") == 0)
v = c->console.path;
......@@ -3860,3 +3860,11 @@ static int get_config_pivotdir(struct lxc_container *c, const char *key,
{
return 0;
}
static int get_config_utsname(struct lxc_container *c, const char *key,
char *retv, int inlen)
{
return lxc_get_conf_str(
retv, inlen,
c->lxc_conf->utsname ? c->lxc_conf->utsname->nodename : NULL);
}
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