[Libguestfs] [PATCH v3 1/7] generator: Deprecate direct mode (guestfs_set_direct, guestfs_get_direct).

Richard W.M. Jones rjones at redhat.com
Sat Mar 4 15:11:00 UTC 2017


---
 generator/actions_properties.ml            | 28 ----------------------------
 generator/actions_properties_deprecated.ml | 30 ++++++++++++++++++++++++++++++
 rescue/rescue.c                            |  3 +++
 test-tool/test-tool.c                      |  1 -
 4 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/generator/actions_properties.ml b/generator/actions_properties.ml
index 8f6455b..87144b1 100644
--- a/generator/actions_properties.ml
+++ b/generator/actions_properties.ml
@@ -260,34 +260,6 @@ C<guestfs_set_event_callback>)." };
 Return the command trace flag." };
 
   { defaults with
-    name = "set_direct"; added = (1, 0, 72);
-    style = RErr, [Bool "direct"], [];
-    fish_alias = ["direct"]; config_only = true;
-    blocking = false;
-    shortdesc = "enable or disable direct appliance mode";
-    longdesc = "\
-If the direct appliance mode flag is enabled, then stdin and
-stdout are passed directly through to the appliance once it
-is launched.
-
-One consequence of this is that log messages aren't caught
-by the library and handled by C<guestfs_set_log_message_callback>,
-but go straight to stdout.
-
-You probably don't want to use this unless you know what you
-are doing.
-
-The default is disabled." };
-
-  { defaults with
-    name = "get_direct"; added = (1, 0, 72);
-    style = RBool "direct", [], [];
-    blocking = false;
-    shortdesc = "get direct appliance mode flag";
-    longdesc = "\
-Return the direct appliance mode flag." };
-
-  { defaults with
     name = "set_recovery_proc"; added = (1, 0, 77);
     style = RErr, [Bool "recoveryproc"], [];
     fish_alias = ["recovery-proc"]; config_only = true;
diff --git a/generator/actions_properties_deprecated.ml b/generator/actions_properties_deprecated.ml
index def17b9..5327782 100644
--- a/generator/actions_properties_deprecated.ml
+++ b/generator/actions_properties_deprecated.ml
@@ -125,6 +125,36 @@ Return the current backend.
 
 See C<guestfs_set_backend> and L<guestfs(3)/BACKEND>." };
 
+  { defaults with
+    name = "set_direct"; added = (1, 0, 72);
+    style = RErr, [Bool "direct"], [];
+    deprecated_by = Deprecated_no_replacement;
+    fish_alias = ["direct"]; config_only = true;
+    blocking = false;
+    shortdesc = "enable or disable direct appliance mode";
+    longdesc = "\
+If the direct appliance mode flag is enabled, then stdin and
+stdout are passed directly through to the appliance once it
+is launched.
+
+One consequence of this is that log messages aren't caught
+by the library and handled by C<guestfs_set_log_message_callback>,
+but go straight to stdout.
+
+You probably don't want to use this unless you know what you
+are doing.
+
+The default is disabled." };
+
+  { defaults with
+    name = "get_direct"; added = (1, 0, 72);
+    style = RBool "direct", [], [];
+    deprecated_by = Deprecated_no_replacement;
+    blocking = false;
+    shortdesc = "get direct appliance mode flag";
+    longdesc = "\
+Return the direct appliance mode flag." };
+
 ]
 
 let daemon_functions = [
diff --git a/rescue/rescue.c b/rescue/rescue.c
index ed40ba6..572a844 100644
--- a/rescue/rescue.c
+++ b/rescue/rescue.c
@@ -295,9 +295,12 @@ main (int argc, char *argv[])
     usage (EXIT_FAILURE);
   }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
   /* Setting "direct mode" is required for the rescue appliance. */
   if (guestfs_set_direct (g, 1) == -1)
     exit (EXIT_FAILURE);
+#pragma GCC diagnostic pop
 
   {
     /* The libvirt backend doesn't support direct mode.  As a temporary
diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c
index 20e2a32..2ae266d 100644
--- a/test-tool/test-tool.c
+++ b/test-tool/test-tool.c
@@ -224,7 +224,6 @@ main (int argc, char *argv[])
   p = guestfs_get_cachedir (g);
   printf ("guestfs_get_cachedir: %s\n", p ? : "(null)");
   free (p);
-  printf ("guestfs_get_direct: %d\n", guestfs_get_direct (g));
   p = guestfs_get_hv (g);
   printf ("guestfs_get_hv: %s\n", p);
   free (p);
-- 
2.9.3




More information about the Libguestfs mailing list