From 1bd1f9b85f45275b1600d148530bc1877ff15213 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 25 May 2010 11:27:49 +0100 Subject: [PATCH] New API: available-all-groups to return list of all optional groups. --- daemon/available.c | 18 ++++++++++++++++++ src/MAX_PROC_NR | 2 +- src/generator.ml | 14 ++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/daemon/available.c b/daemon/available.c index 77fdfa2..2a30cad 100644 --- a/daemon/available.c +++ b/daemon/available.c @@ -53,3 +53,21 @@ do_available (char *const *groups) return 0; } + +char ** +do_available_all_groups (void) +{ + size_t i; + char **groups = NULL; + int size = 0, alloc = 0; + + for (i = 0; optgroups[i].group != NULL; ++i) { + if (add_string (&groups, &size, &alloc, optgroups[i].group) == -1) + return NULL; + } + + if (add_string (&groups, &size, &alloc, NULL) == -1) + return NULL; + + return groups; /* caller frees */ +} diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index cb1a40d..1f7e0d6 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -250 +251 diff --git a/src/generator.ml b/src/generator.ml index ccadbfd..f094749 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -4278,6 +4278,8 @@ the libguestfs appliance will be able to provide. The libguestfs groups, and the functions that those groups correspond to, are listed in L. +You can also fetch this list at runtime by calling +C. The argument C is a list of group names, eg: C<[\"inotify\", \"augeas\"]> would check for the availability of @@ -4708,6 +4710,18 @@ allows you to specify the new size (in bytes) explicitly."); This command is the same as C except that it allows you to specify the new size (in bytes) explicitly."); + ("available_all_groups", (RStringList "groups", []), 251, [], + [], + "return a list of all optional groups", + "\ +This command returns a list of all optional groups that this +daemon knows about. Note this returns both supported and unsupported +groups. To find out which ones the daemon can actually support +you have to call C on each member of the +returned list. + +See also C and L."); + ] let all_functions = non_daemon_functions @ daemon_functions -- 1.8.3.1