[PATCH 06/14] Rename suspend capabilities APIs

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Rename virGetPMCapabilities to virNodeSuspendGetTargetMask and
virDiscoverHostPMFeature to virNodeSuspendSupportsTarget.

* src/util/util.c, src/util/util.h: Rename APIs
* src/qemu/qemu_capabilities.c, src/util/virnodesuspend.c: Adjust
  for new names
---
 src/qemu/qemu_capabilities.c |    2 +-
 src/util/util.c              |   22 +++++++++++-----------
 src/util/util.h              |    4 ++--
 src/util/virnodesuspend.c    |    2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c5fe41d..4bbfd78 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -850,7 +850,7 @@ virCapsPtr qemuCapsInit(virCapsPtr old_caps)
 
     /* Add the power management features of the host */
 
-    if (virGetPMCapabilities(&caps->host.powerMgmt) < 0) {
+    if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0) {
         VIR_WARN("Failed to get host power management capabilities");
         caps->host.powerMgmt_valid = false;
     } else
diff --git a/src/util/util.c b/src/util/util.c
index badfa3a..72fbdac 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -2623,8 +2623,8 @@ virTypedParameterArrayClear(virTypedParameterPtr params, int nparams)
 }
 
 /**
- * virDiscoverHostPMFeature:
- * @feature: The power management feature to check whether it is supported
+ * virNodeSuspendSupportsTarget:
+ * @target: The power management target to check whether it is supported
  *           by the host. Values could be:
  *           VIR_NODE_SUSPEND_TARGET_MEM
  *           VIR_NODE_SUSPEND_TARGET_DISK
@@ -2632,12 +2632,12 @@ virTypedParameterArrayClear(virTypedParameterPtr params, int nparams)
  * @supported: set to true if supported, false otherwise
  *
  * Run the script 'pm-is-supported' (from the pm-utils package)
- * to find out if @feature is supported by the host.
+ * to find out if @target is supported by the host.
  *
  * Returns 0 if the query was successful, -1 on failure.
  */
 int
-virDiscoverHostPMFeature(unsigned int feature, bool *supported)
+virNodeSuspendSupportsTarget(unsigned int target, bool *supported)
 {
     virCommandPtr cmd;
     int status;
@@ -2645,7 +2645,7 @@ virDiscoverHostPMFeature(unsigned int feature, bool *supported)
 
     *supported = false;
 
-    switch (feature) {
+    switch (target) {
     case VIR_NODE_SUSPEND_TARGET_MEM:
         cmd = virCommandNewArgList("pm-is-supported", "--suspend", NULL);
         break;
@@ -2675,19 +2675,19 @@ cleanup:
 }
 
 /**
- * virGetPMCapabilities:
+ * virNodeSuspendGetTargetMask:
  *
  * Get the Power Management Capabilities that the host system supports,
  * such as Suspend-to-RAM (S3), Suspend-to-Disk (S4) and Hybrid-Suspend
  * (a combination of S3 and S4).
  *
  * @bitmask: Pointer to the bitmask which will be set appropriately to
- *           indicate all the supported host power management features.
+ *           indicate all the supported host power management targets.
  *
  * Returns 0 if the query was successful, -1 on failure.
  */
 int
-virGetPMCapabilities(unsigned int *bitmask)
+virNodeSuspendGetTargetMask(unsigned int *bitmask)
 {
     int ret;
     bool supported;
@@ -2695,21 +2695,21 @@ virGetPMCapabilities(unsigned int *bitmask)
     *bitmask = 0;
 
     /* Check support for Suspend-to-RAM (S3) */
-    ret = virDiscoverHostPMFeature(VIR_NODE_SUSPEND_TARGET_MEM, &supported);
+    ret = virNodeSuspendSupportsTarget(VIR_NODE_SUSPEND_TARGET_MEM, &supported);
     if (ret < 0)
         return -1;
     if (supported)
         *bitmask |= (1 << VIR_NODE_SUSPEND_TARGET_MEM);
 
     /* Check support for Suspend-to-Disk (S4) */
-    ret = virDiscoverHostPMFeature(VIR_NODE_SUSPEND_TARGET_DISK, &supported);
+    ret = virNodeSuspendSupportsTarget(VIR_NODE_SUSPEND_TARGET_DISK, &supported);
     if (ret < 0)
         return -1;
     if (supported)
         *bitmask |= (1 << VIR_NODE_SUSPEND_TARGET_DISK);
 
     /* Check support for Hybrid-Suspend */
-    ret = virDiscoverHostPMFeature(VIR_NODE_SUSPEND_TARGET_HYBRID, &supported);
+    ret = virNodeSuspendSupportsTarget(VIR_NODE_SUSPEND_TARGET_HYBRID, &supported);
     if (ret < 0)
         return -1;
     if (supported)
diff --git a/src/util/util.h b/src/util/util.h
index 6a9de7e..6713547 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -263,7 +263,7 @@ void virTypedParameterArrayClear(virTypedParameterPtr params, int nparams);
 
 /* Power Management Capabilities of the host system */
 
-int virDiscoverHostPMFeature(unsigned int feature, bool *supported);
-int virGetPMCapabilities(unsigned int *bitmask);
+int virNodeSuspendSupportsTarget(unsigned int target, bool *supported);
+int virNodeSuspendGetTargetMask(unsigned int *bitmask);
 
 #endif /* __VIR_UTIL_H__ */
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 01feaa2..0814c36 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -81,7 +81,7 @@ int virNodeSuspendInit(void)
 
     /* Get the power management capabilities supported by the host */
     hostPMFeatures = 0;
-    if (virGetPMCapabilities(&hostPMFeatures) < 0) {
+    if (virNodeSuspendGetTargetMask(&hostPMFeatures) < 0) {
         if (geteuid() == 0)
             VIR_ERROR(_("Failed to get host power management features"));
     }
-- 
1.7.6.4

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]