Patchwork qmp: Care for linux without fsfreeze

login
register
mail settings
Submitter Richard Henderson
Date April 19, 2012, 12:10 p.m.
Message ID <1334837414-30510-1-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/153731/
State New
Headers show

Comments

Richard Henderson - April 19, 2012, 12:10 p.m.
Debian 5.0.8 does not define FIFREEZE.
Disentangle CONFIG_FSFREEZE from __linux__.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/commands-posix.c |   48 ++++++++++++++++++++++--------------------------
 1 files changed, 22 insertions(+), 26 deletions(-)
Luiz Capitulino - April 19, 2012, 1:35 p.m.
On Thu, 19 Apr 2012 07:10:14 -0500
Richard Henderson <rth@twiddle.net> wrote:

> Debian 5.0.8 does not define FIFREEZE.
> Disentangle CONFIG_FSFREEZE from __linux__.

Michael has already posted a fix for this.

Patch

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index faf970d..83b400d 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -312,8 +312,6 @@  static void guest_file_init(void)
 }
 
 /* linux-specific implementations. avoid this if at all possible. */
-#if defined(__linux__)
-
 #if defined(CONFIG_FSFREEZE)
 
 static void disable_logging(void)
@@ -511,8 +509,30 @@  static void guest_fsfreeze_cleanup(void)
         }
     }
 }
+#else /* defined(CONFIG_FSFREEZE) */
+GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+
+    return 0;
+}
+
+int64_t qmp_guest_fsfreeze_freeze(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+
+    return 0;
+}
+
+int64_t qmp_guest_fsfreeze_thaw(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+
+    return 0;
+}
 #endif /* CONFIG_FSFREEZE */
 
+#if defined(__linux__)
 #define LINUX_SYS_STATE_FILE "/sys/power/state"
 #define SUSPEND_SUPPORTED 0
 #define SUSPEND_NOT_SUPPORTED 1
@@ -878,30 +898,7 @@  error:
     qapi_free_GuestNetworkInterfaceList(head);
     return NULL;
 }
-
 #else /* defined(__linux__) */
-
-GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
-{
-    error_set(err, QERR_UNSUPPORTED);
-
-    return 0;
-}
-
-int64_t qmp_guest_fsfreeze_freeze(Error **err)
-{
-    error_set(err, QERR_UNSUPPORTED);
-
-    return 0;
-}
-
-int64_t qmp_guest_fsfreeze_thaw(Error **err)
-{
-    error_set(err, QERR_UNSUPPORTED);
-
-    return 0;
-}
-
 void qmp_guest_suspend_disk(Error **err)
 {
     error_set(err, QERR_UNSUPPORTED);
@@ -922,7 +919,6 @@  GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
     error_set(errp, QERR_UNSUPPORTED);
     return NULL;
 }
-
 #endif
 
 /* register init/cleanup routines for stateful command groups */