confile: extend call back system

parent 72be9ed7
...@@ -407,7 +407,7 @@ static int config_network_nic(const char *key, const char *value, ...@@ -407,7 +407,7 @@ static int config_network_nic(const char *key, const char *value,
ERROR("unknown key %s", key); ERROR("unknown key %s", key);
goto out; goto out;
} }
ret = config->cb(key, value, lxc_conf); ret = config->set(key, value, lxc_conf);
out: out:
free(copy); free(copy);
...@@ -2418,7 +2418,7 @@ static int parse_line(char *buffer, void *data) ...@@ -2418,7 +2418,7 @@ static int parse_line(char *buffer, void *data)
goto out; goto out;
} }
ret = config->cb(key, value, plc->conf); ret = config->set(key, value, plc->conf);
out: out:
free(linep); free(linep);
......
...@@ -34,7 +34,9 @@ struct lxc_list; ...@@ -34,7 +34,9 @@ struct lxc_list;
typedef int (*config_cb)(const char *, const char *, struct lxc_conf *); typedef int (*config_cb)(const char *, const char *, struct lxc_conf *);
struct lxc_config_t { struct lxc_config_t {
char *name; char *name;
config_cb cb; config_cb set;
config_cb get;
config_cb clear;
}; };
extern struct lxc_config_t *lxc_getconfig(const char *key); extern struct lxc_config_t *lxc_getconfig(const char *key);
......
...@@ -2461,7 +2461,7 @@ static bool set_config_item_locked(struct lxc_container *c, const char *key, con ...@@ -2461,7 +2461,7 @@ static bool set_config_item_locked(struct lxc_container *c, const char *key, con
config = lxc_getconfig(key); config = lxc_getconfig(key);
if (!config) if (!config)
return false; return false;
if (config->cb(key, v, c->lxc_conf) != 0) if (config->set(key, v, c->lxc_conf) != 0)
return false; return false;
return do_append_unexp_config_line(c->lxc_conf, key, v); return do_append_unexp_config_line(c->lxc_conf, key, v);
} }
......
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