confile: extend call back system

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2017-05-31 04:27:57 +02:00
parent 72be9ed7b2
commit d37f7cd727
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D
3 changed files with 6 additions and 4 deletions

View File

@ -407,7 +407,7 @@ static int config_network_nic(const char *key, const char *value,
ERROR("unknown key %s", key);
goto out;
}
ret = config->cb(key, value, lxc_conf);
ret = config->set(key, value, lxc_conf);
out:
free(copy);
@ -2418,7 +2418,7 @@ static int parse_line(char *buffer, void *data)
goto out;
}
ret = config->cb(key, value, plc->conf);
ret = config->set(key, value, plc->conf);
out:
free(linep);

View File

@ -34,7 +34,9 @@ struct lxc_list;
typedef int (*config_cb)(const char *, const char *, struct lxc_conf *);
struct lxc_config_t {
char *name;
config_cb cb;
config_cb set;
config_cb get;
config_cb clear;
};
extern struct lxc_config_t *lxc_getconfig(const char *key);

View File

@ -2461,7 +2461,7 @@ static bool set_config_item_locked(struct lxc_container *c, const char *key, con
config = lxc_getconfig(key);
if (!config)
return false;
if (config->cb(key, v, c->lxc_conf) != 0)
if (config->set(key, v, c->lxc_conf) != 0)
return false;
return do_append_unexp_config_line(c->lxc_conf, key, v);
}