struct lxc_config_t *item;
memset(&rsp, 0, sizeof(rsp));
- item = lxc_getconfig(req->data);
+ item = lxc_get_config(req->data);
if (!item)
goto err1;
cilen = item->get(req->data, NULL, 0, handler->conf, NULL);
static const size_t config_size = sizeof(config) / sizeof(struct lxc_config_t);
-extern struct lxc_config_t *lxc_getconfig(const char *key)
+struct lxc_config_t *lxc_get_config(const char *key)
{
size_t i;
for (i = 0; i < config_size; i++)
if (!strncmp(config[i].name, key, strlen(config[i].name)))
return &config[i];
+
return NULL;
}
}
}
- config = lxc_getconfig(key);
+ config = lxc_get_config(key);
if (!config) {
ERROR("unknown key %s", key);
goto out;
memmove(copy + 8, idx_end + 1, strlen(idx_end + 1));
copy[strlen(key) - numstrlen + 1] = '\0';
- config = lxc_getconfig(copy);
+ config = lxc_get_config(copy);
if (!config) {
ERROR("unknown network configuration key %s", key);
goto on_error;
for (i = 0; i < config_size; i++) {
char *s = config[i].name;
+
if (s[strlen(s) - 1] == '.')
continue;
+
strprint(retv, inlen, "%s\n", s);
}
config_clr_cb clr;
};
-extern struct lxc_config_t *lxc_getconfig(const char *key);
+extern struct lxc_config_t *lxc_get_config(const char *key);
/* List all configuration items associated with a given network. For example
* pass "lxc.net.[i]" to retrieve all configuration items associated with
goto out;
strcpy(copy + 12, p + 1);
- config = lxc_getconfig(copy);
+ config = lxc_get_config(copy);
if (!config) {
ERROR("unknown key %s", key);
goto out;
if (container_mem_lock(c))
return false;
- config = lxc_getconfig(key);
+ config = lxc_get_config(key);
/* Verify that the config key exists and that it has a callback
* implemented.
*/
if (container_mem_lock(c))
return -1;
- config = lxc_getconfig(key);
+ config = lxc_get_config(key);
/* Verify that the config key exists and that it has a callback
* implemented.
*/
static int do_lxcapi_get_keys(struct lxc_container *c, const char *key, char *retv, int inlen)
{
+ int ret = -1;
+
+ /* List all config items. */
if (!key)
return lxc_list_config_items(retv, inlen);
- /*
- * Support 'lxc.net.<idx>', i.e. 'lxc.net.0'
- * This is an intelligent result to show which keys are valid given
- * the type of nic it is
- */
+
if (!c || !c->lxc_conf)
return -1;
+
if (container_mem_lock(c))
return -1;
- int ret = -1;
+
+ /* Support 'lxc.net.<idx>', i.e. 'lxc.net.0'
+ * This is an intelligent result to show which keys are valid given the
+ * type of nic it is.
+ */
if (!strncmp(key, "lxc.net.", 8))
ret = lxc_list_net(c->lxc_conf, key, retv, inlen);
else if (strncmp(key, "lxc.network.", 12) == 0)
ret = lxc_list_nicconfigs_legacy(c->lxc_conf, key, retv, inlen);
+
container_mem_unlock(c);
return ret;
}
if (!c->lxc_conf)
return false;
- config = lxc_getconfig(key);
+ config = lxc_get_config(key);
if (!config)
return false;
bool lxc_config_item_is_supported(const char *key)
{
- return !!lxc_getconfig(key);
+ return !!lxc_get_config(key);
}
for (key = strtok_r(keys, "\n", &saveptr); key != NULL;
key = strtok_r(NULL, "\n", &saveptr)) {
struct lxc_config_t *config;
- config = lxc_getconfig(key);
+ config = lxc_get_config(key);
if (!config) {
lxc_error("configuration key \"%s\" not implemented in "
"jump table",