From: "Daniel P. Berrange" <berra...@redhat.com>

The internal virHostPMCapability enum just duplicates the
public virNodeSuspendTarget enum, but with different names.

* src/util/util.c: Use VIR_NODE_SUSPEND_TARGET constants
* src/util/util.h: Remove virHostPMCapability enum
* src/conf/capabilities.c: Use VIR_NODE_SUSPEND_TARGET_LAST
---
 src/conf/capabilities.c |    2 +-
 src/util/util.c         |   18 +++++++++---------
 src/util/util.h         |    8 --------
 3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 70f9ab0..a2ca46b 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -36,7 +36,7 @@
 
 #define VIR_FROM_THIS VIR_FROM_CAPABILITIES
 
-VIR_ENUM_IMPL(virHostPMCapability, VIR_HOST_PM_LAST,
+VIR_ENUM_IMPL(virHostPMCapability, VIR_NODE_SUSPEND_TARGET_LAST,
               "S3", "S4", "Hybrid-Suspend")
 
 /**
diff --git a/src/util/util.c b/src/util/util.c
index 34541ec..5bd8c91 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -2628,9 +2628,9 @@ virTypedParameterArrayClear(virTypedParameterPtr params, 
int nparams)
  *           the query
  * @feature: The power management feature to check whether it is supported
  *           by the host. Values could be:
- *           VIR_HOST_PM_S3 for Suspend-to-RAM
- *           VIR_HOST_PM_S4 for Suspend-to-Disk
- *           VIR_HOST_PM_HYBRID_SUSPEND for Hybrid-Suspend
+ *           VIR_NODE_SUSPEND_TARGET_MEM
+ *           VIR_NODE_SUSPEND_TARGET_DISK
+ *           VIR_NODE_SUSPEND_TARGET_HYBRID
  *
  * Run the script 'pm-is-supported' (from the pm-utils package)
  * to find out if @feature is supported by the host.
@@ -2645,13 +2645,13 @@ virDiscoverHostPMFeature(unsigned int *bitmask, 
unsigned int feature)
     int ret = -1;
 
     switch (feature) {
-    case VIR_HOST_PM_S3:
+    case VIR_NODE_SUSPEND_TARGET_MEM:
         cmd = virCommandNewArgList("pm-is-supported", "--suspend", NULL);
         break;
-    case VIR_HOST_PM_S4:
+    case VIR_NODE_SUSPEND_TARGET_DISK:
         cmd = virCommandNewArgList("pm-is-supported", "--hibernate", NULL);
         break;
-    case VIR_HOST_PM_HYBRID_SUSPEND:
+    case VIR_NODE_SUSPEND_TARGET_HYBRID:
         cmd = virCommandNewArgList("pm-is-supported", "--suspend-hybrid", 
NULL);
         break;
     default:
@@ -2695,17 +2695,17 @@ virGetPMCapabilities(unsigned int *bitmask)
     *bitmask = 0;
 
     /* Check support for Suspend-to-RAM (S3) */
-    ret = virDiscoverHostPMFeature(bitmask, VIR_HOST_PM_S3);
+    ret = virDiscoverHostPMFeature(bitmask, VIR_NODE_SUSPEND_TARGET_MEM);
     if (ret < 0)
         return -1;
 
     /* Check support for Suspend-to-Disk (S4) */
-    ret = virDiscoverHostPMFeature(bitmask, VIR_HOST_PM_S4);
+    ret = virDiscoverHostPMFeature(bitmask, VIR_NODE_SUSPEND_TARGET_DISK);
     if (ret < 0)
         return -1;
 
     /* Check support for Hybrid-Suspend */
-    ret = virDiscoverHostPMFeature(bitmask, VIR_HOST_PM_HYBRID_SUSPEND);
+    ret = virDiscoverHostPMFeature(bitmask, VIR_NODE_SUSPEND_TARGET_HYBRID);
     if (ret < 0)
         return -1;
 
diff --git a/src/util/util.h b/src/util/util.h
index eda60d2..690fca0 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -263,14 +263,6 @@ void virTypedParameterArrayClear(virTypedParameterPtr 
params, int nparams);
 
 /* Power Management Capabilities of the host system */
 
-enum virHostPMCapability {
-    VIR_HOST_PM_S3,              /* Suspend-to-RAM */
-    VIR_HOST_PM_S4,              /* Suspend-to-Disk */
-    VIR_HOST_PM_HYBRID_SUSPEND,  /* Hybrid-Suspend */
-
-    VIR_HOST_PM_LAST
-};
-
 VIR_ENUM_DECL(virHostPMCapability)
 
 int virDiscoverHostPMFeature(unsigned int *bitmask, unsigned int feature);
-- 
1.7.6.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to