[Libguestfs] [PATCH 1/4] generator: add always-available optgroups

Richard W.M. Jones rjones at redhat.com
Tue May 20 20:40:21 UTC 2014


On Tue, May 20, 2014 at 07:54:45PM +0200, Pino Toscano wrote:
> Support the possibility to have optional groups always enabled (e.g.
> because they were present in the past, and they need to be kept for
> users).
> Add and use few helper optgroups-related functions to deal also with
> them.

What do you think about the attached addition to this patch?

(It is meant to be squashed into your patch.)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
-------------- next part --------------
>From 4a7afe56aa3124284df6ca0d26dab75b9bda7f7a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones at redhat.com>
Date: Tue, 20 May 2014 21:39:08 +0100
Subject: [PATCH] NOT TO BE APPLIED: UPDATE [PATCH 1/4] generator: add
 always-available optgroups

---
 generator/daemon.ml    |  4 ++--
 generator/optgroups.ml | 15 ++++-----------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/generator/daemon.ml b/generator/daemon.ml
index 65d910a..7b401a7 100644
--- a/generator/daemon.ml
+++ b/generator/daemon.ml
@@ -713,7 +713,7 @@ and generate_daemon_optgroups_c () =
   pr "#include \"optgroups.h\"\n";
   pr "\n";
 
-  if optgroups_available <> [] then (
+  if optgroups_retired <> [] then (
     pr "static int\n";
     pr "dummy_available (void)\n";
     pr "{\n";
@@ -724,7 +724,7 @@ and generate_daemon_optgroups_c () =
     List.iter (
       fun group ->
         pr "#define optgroup_%s_available dummy_available\n" group;
-    ) optgroups_available;
+    ) optgroups_retired;
 
     pr "\n";
   );
diff --git a/generator/optgroups.ml b/generator/optgroups.ml
index eb5ff74..b0b5feb 100644
--- a/generator/optgroups.ml
+++ b/generator/optgroups.ml
@@ -22,7 +22,8 @@ open Types
 open Actions
 
 (* The list of optional groups which need to be in the daemon as always
- * available.
+ * available.  These are "retired" as they no longer appear in the
+ * list of functions.
  *
  * NOTE: if a optional group listed here has functions using it, then its
  * presence here will be ignored (thus being handled as usual). This way,
@@ -30,7 +31,7 @@ open Actions
  * added (as it means at some point they had no more functions using them,
  * but libguestfs ought to provide them to the user.
  *)
-let internal_optgroups_available = [
+let optgroups_retired = [
   "realpath";
 ]
 
@@ -59,13 +60,5 @@ let optgroups =
 let optgroups_names =
   fst (List.split optgroups)
 
-let optgroups_available =
-  let groups =
-    List.filter (
-      fun group ->
-        List.mem group optgroups_names <> true
-    ) internal_optgroups_available in
-  List.sort compare groups
-
 let optgroups_names_all =
-  List.sort compare (optgroups_names @ optgroups_available)
+  List.sort compare (optgroups_names @ optgroups_retired)
-- 
1.9.0



More information about the Libguestfs mailing list