Unverified Commit 48dea346 by Christian Brauner Committed by Stéphane Graber

confile: lxc_listconfigs -> lxc_list_config_items

parent 5a199088
...@@ -491,27 +491,6 @@ extern struct lxc_config_t *lxc_getconfig(const char *key) ...@@ -491,27 +491,6 @@ extern struct lxc_config_t *lxc_getconfig(const char *key)
} \ } \
} while (0); } while (0);
int lxc_listconfigs(char *retv, int inlen)
{
size_t i;
int len;
int fulllen = 0;
if (!retv)
inlen = 0;
else
memset(retv, 0, inlen);
for (i = 0; i < config_size; i++) {
char *s = config[i].name;
if (s[strlen(s) - 1] == '.')
continue;
strprint(retv, inlen, "%s\n", s);
}
return fulllen;
}
static int set_config_string_item(char **conf_item, const char *value) static int set_config_string_item(char **conf_item, const char *value)
{ {
char *new_value; char *new_value;
...@@ -3930,3 +3909,24 @@ static int get_config_includefiles(const char *key, char *retv, int inlen, ...@@ -3930,3 +3909,24 @@ static int get_config_includefiles(const char *key, char *retv, int inlen,
{ {
return -ENOSYS; return -ENOSYS;
} }
int lxc_list_config_items(char *retv, int inlen)
{
size_t i;
int len;
int fulllen = 0;
if (!retv)
inlen = 0;
else
memset(retv, 0, inlen);
for (i = 0; i < config_size; i++) {
char *s = config[i].name;
if (s[strlen(s) - 1] == '.')
continue;
strprint(retv, inlen, "%s\n", s);
}
return fulllen;
}
...@@ -47,7 +47,7 @@ struct lxc_config_t { ...@@ -47,7 +47,7 @@ struct lxc_config_t {
extern struct lxc_config_t *lxc_getconfig(const char *key); extern struct lxc_config_t *lxc_getconfig(const char *key);
extern int lxc_list_nicconfigs(struct lxc_conf *c, const char *key, char *retv, int inlen); extern int lxc_list_nicconfigs(struct lxc_conf *c, const char *key, char *retv, int inlen);
extern int lxc_listconfigs(char *retv, int inlen); extern int lxc_list_config_items(char *retv, int inlen);
extern int lxc_config_read(const char *file, struct lxc_conf *conf, bool from_include); extern int lxc_config_read(const char *file, struct lxc_conf *conf, bool from_include);
extern int append_unexp_config_line(const char *line, struct lxc_conf *conf); extern int append_unexp_config_line(const char *line, struct lxc_conf *conf);
......
...@@ -2193,7 +2193,7 @@ WRAP_API_1(char *, lxcapi_get_running_config_item, const char *) ...@@ -2193,7 +2193,7 @@ WRAP_API_1(char *, lxcapi_get_running_config_item, const char *)
static int do_lxcapi_get_keys(struct lxc_container *c, const char *key, char *retv, int inlen) static int do_lxcapi_get_keys(struct lxc_container *c, const char *key, char *retv, int inlen)
{ {
if (!key) if (!key)
return lxc_listconfigs(retv, inlen); return lxc_list_config_items(retv, inlen);
/* /*
* Support 'lxc.network.<idx>', i.e. 'lxc.network.0' * Support 'lxc.network.<idx>', i.e. 'lxc.network.0'
* This is an intelligent result to show which keys are valid given * This is an intelligent result to show which keys are valid given
......
...@@ -38,7 +38,7 @@ int main(int argc, char *argv[]) ...@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
int fulllen = 0, inlen = 0, ret = EXIT_FAILURE; int fulllen = 0, inlen = 0, ret = EXIT_FAILURE;
char *key, *keys, *saveptr = NULL; char *key, *keys, *saveptr = NULL;
fulllen = lxc_listconfigs(NULL, inlen); fulllen = lxc_list_config_items(NULL, inlen);
keys = malloc(sizeof(char) * fulllen + 1); keys = malloc(sizeof(char) * fulllen + 1);
if (!keys) { if (!keys) {
...@@ -46,7 +46,7 @@ int main(int argc, char *argv[]) ...@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
exit(ret); exit(ret);
} }
if (lxc_listconfigs(keys, fulllen) != fulllen) { if (lxc_list_config_items(keys, fulllen) != fulllen) {
lxc_error("%s\n", "failed to retrieve configuration keys"); lxc_error("%s\n", "failed to retrieve configuration keys");
goto on_error; goto on_error;
} }
......
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