lxc_config_define(console_path);
lxc_config_define(console_rotate);
lxc_config_define(console_size);
+lxc_config_define(unsupported_key);
lxc_config_define(environment);
lxc_config_define(ephemeral);
lxc_config_define(execute_cmd);
lxc_config_define(sysctl);
lxc_config_define(proc);
+static int set_config_unsupported_key(const char *key, const char *value,
+ struct lxc_conf *lxc_conf, void *data)
+{
+ return syserror_set(-EINVAL, "Unsupported config key \"%s\"", key);
+}
+
+static int get_config_unsupported_key(const char *key, char *retv, int inlen,
+ struct lxc_conf *c, void *data)
+{
+ return syserror_set(-EINVAL, "Unsupported config key \"%s\"", key);
+}
+
+static int clr_config_unsupported_key(const char *key,
+ struct lxc_conf *lxc_conf, void *data)
+{
+ return syserror_set(-EINVAL, "Unsupported config key \"%s\"", key);
+}
+
/*
* Important Note:
* If a new config option is added to this table, be aware that
{ "lxc.proc", false, set_config_proc, get_config_proc, clr_config_proc, },
};
+static struct lxc_config_t unsupported_config_key = {
+ NULL,
+ false,
+ set_config_unsupported_key,
+ get_config_unsupported_key,
+ clr_config_unsupported_key,
+};
+
struct lxc_config_net_t {
LXC_CONFIG_MEMBERS;
};
{ "veth.vlan.tagged.id", true, set_config_net_veth_vlan_tagged_id, get_config_net_veth_vlan_tagged_id, clr_config_net_veth_vlan_tagged_id, },
};
+static struct lxc_config_net_t unsupported_config_net_key = {
+ NULL,
+ false,
+ set_config_unsupported_key,
+ get_config_unsupported_key,
+ clr_config_unsupported_key,
+};
+
struct lxc_config_t *lxc_get_config_exact(const char *key)
{
size_t i;
case 0:
continue;
case -E2BIG:
- return NULL;
+ return &unsupported_config_key;
}
return cur;
}
- return NULL;
+ return &unsupported_config_key;
}
static inline bool match_config_net_item(const struct lxc_config_net_t *entry,
return cur;
}
- return NULL;
+ return &unsupported_config_net_key;
}
static int set_config_net(const char *key, const char *value,
}
config = lxc_get_config(key);
- if (!config)
- return log_error_errno(-EINVAL, EINVAL, "Unknown configuration key \"%s\"", key);
-
return config->set(key, value, plc->conf, NULL);
}
/* lxc.net.<idx>.<subkey> */
info->ops = lxc_get_config_net(info->subkey);
- if (!info->ops)
+ if (info->ops == &unsupported_config_net_key)
return syserror_set(-ENOENT, "Unknown network configuration key \"%s\"", key);
return 0;
return false;
config = lxc_get_config(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, NULL);
+ ret = config->clr(key, c->lxc_conf, NULL);
if (!ret)
do_clear_unexp_config_line(c->lxc_conf, key);
return -1;
config = lxc_get_config(key);
- /* Verify that the config key exists and that it has a callback
- * implemented.
- */
- if (config && config->get)
- ret = config->get(key, retv, inlen, c->lxc_conf, NULL);
+
+ ret = config->get(key, retv, inlen, c->lxc_conf, NULL);
container_mem_unlock(c);
return ret;
bool bret = true;
config = lxc_get_config(key);
- if (!config)
- return -EINVAL;
ret = config->set(key, v, conf, NULL);
if (ret < 0)