char *addr = NULL, *bcast = NULL, *prefix = NULL;
if (config_value_empty(value))
- return lxc_clear_config_item(lxc_conf, key);
+ return clr_config_network_item(key, lxc_conf);
netdev = network_netdev(key, value, &lxc_conf->network);
if (!netdev)
char *slash, *valdup, *netmask;
if (config_value_empty(value))
- return lxc_clear_config_item(lxc_conf, key);
+ return clr_config_network_item(key, lxc_conf);
netdev = network_netdev(key, value, &lxc_conf->network);
if (!netdev)
struct lxc_conf *lxc_conf)
{
if (config_value_empty(value)) {
- lxc_clear_config_item(lxc_conf, key);
+ clr_config_fstab(key, lxc_conf);
return -1;
}
{
/* Set config value to default. */
if (config_value_empty(value)) {
- lxc_clear_config_item(lxc_conf, key);
+ clr_config_includefiles(key, lxc_conf);
return 0;
}
struct utsname *utsname;
if (config_value_empty(value)) {
- lxc_clear_config_item(lxc_conf, key);
+ clr_config_utsname(key, lxc_conf);
return 0;
}
return snprintf(retv, inlen, "%d", v);
}
-int lxc_clear_config_item(struct lxc_conf *c, const char *key)
-{
- return 0;
-}
-
/* Write out a configuration file. */
void write_config(FILE *fout, struct lxc_conf *c)
{
WARN("Error clearing configuration for %s", key);
}
-static bool do_lxcapi_clear_config_item(struct lxc_container *c, const char *key)
+static bool do_lxcapi_clear_config_item(struct lxc_container *c,
+ const char *key)
{
- int ret;
+ int ret = 1;
+ struct lxc_config_t *config;
if (!c || !c->lxc_conf)
return false;
+
if (container_mem_lock(c))
return false;
- ret = lxc_clear_config_item(c->lxc_conf, key);
+
+ config = lxc_getconfig(key);
+ /* Verify that the config key exists and that it has a callback
+ * implemented.
+ */
+ if (config && config->clr)
+ ret = config->clr(key, c->lxc_conf);
if (!ret)
do_clear_unexp_config_line(c->lxc_conf, key);
+
container_mem_unlock(c);
return ret == 0;
}