[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] fix build erro when building with --without-libvirtd



---
 src/driver.h           |  4 ---
 src/libvirt.c          | 70 +++++++++++++++++++++++++++++++++++++++++++++++++-
 src/libvirt_internal.h |  2 --
 3 files changed, 69 insertions(+), 7 deletions(-)

diff --git a/src/driver.h b/src/driver.h
index 02ddd83..dab7495 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -1512,7 +1512,6 @@ struct _virStorageDriver {
     virDrvStoragePoolIsPersistent           poolIsPersistent;
 };
 
-# ifdef WITH_LIBVIRTD
 
 typedef int (*virDrvStateInitialize) (bool privileged,
                                       virStateInhibitCallback callback,
@@ -1531,7 +1530,6 @@ struct _virStateDriver {
     virDrvStateReload      reload;
     virDrvStateStop        stop;
 };
-# endif
 
 
 typedef struct _virDeviceMonitor virDeviceMonitor;
@@ -1768,9 +1766,7 @@ int virRegisterStorageDriver(virStorageDriverPtr);
 int virRegisterDeviceMonitor(virDeviceMonitorPtr);
 int virRegisterSecretDriver(virSecretDriverPtr);
 int virRegisterNWFilterDriver(virNWFilterDriverPtr);
-# ifdef WITH_LIBVIRTD
 int virRegisterStateDriver(virStateDriverPtr);
-# endif
 void virDriverModuleInitialize(const char *defmoddir);
 void *virDriverLoadModule(const char *name);
 
diff --git a/src/libvirt.c b/src/libvirt.c
index f81a3de..38e4f6e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -885,8 +885,76 @@ int virStateStop(void) {
     return ret;
 }
 
-#endif
+#else /* WITH_LIBVIRTD */
+
+/**
+ * virRegisterStateDriver:
+ * @driver: pointer to a driver block
+ *
+ * Register a virtualization driver
+ *
+ * Returns the driver priority or -1 in case of error.
+ */
+int
+virRegisterStateDriver(virStateDriverPtr driver ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+
+/**
+ * virStateInitialize:
+ * @privileged: set to true if running with root privilege, false otherwise
+ * @callback: callback to invoke to inhibit shutdown of the daemon
+ * @opaque: data to pass to @callback
+ *
+ * Initialize all virtualization drivers.
+ *
+ * Returns 0 if all succeed, -1 upon any failure.
+ */
+int virStateInitialize(bool privileged ATTRIBUTE_UNUSED,
+                       virStateInhibitCallback callback ATTRIBUTE_UNUSED,
+                       void *opaque ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+
+/**
+ * virStateCleanup:
+ *
+ * Run each virtualization driver's cleanup method.
+ *
+ * Returns 0 if all succeed, -1 upon any failure.
+ */
+int virStateCleanup(void)
+{
+    return 0;
+}
+
+/**
+ * virStateReload:
+ *
+ * Run each virtualization driver's reload method.
+ *
+ * Returns 0 if all succeed, -1 upon any failure.
+ */
+int virStateReload(void)
+{
+    return 0;
+}
+
+/**
+ * virStateStop:
+ *
+ * Run each virtualization driver's "stop" method.
+ *
+ * Returns 0 if successful, -1 on failure
+ */
+int virStateStop(void)
+{
+    return 0;
+}
 
+#endif /* WITH_LIBVIRTD */
 
 
 /**
diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h
index 595d2db..b82f6b9 100644
--- a/src/libvirt_internal.h
+++ b/src/libvirt_internal.h
@@ -27,7 +27,6 @@
 
 # include "internal.h"
 
-# ifdef WITH_LIBVIRTD
 typedef void (*virStateInhibitCallback)(bool inhibit,
                                         void *opaque);
 
@@ -37,7 +36,6 @@ int virStateInitialize(bool privileged,
 int virStateCleanup(void);
 int virStateReload(void);
 int virStateStop(void);
-# endif
 
 /* Feature detection.  This is a libvirt-private interface for determining
  * what features are supported by the driver.
-- 
1.8.0.1.240.ge8a1f5a


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]