[PATCH v2 7/8] qemu: Remove qemuCompressProgramAvailable

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

 



There's only one caller and the code is duplicitous just converting the
recently converted cfg image name back into it's string value in order to
get/find the path to the image.  A subsequent patch can return this path.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8a47262..6b755a5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3250,22 +3250,6 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
     return ret;
 }
 
-/* Returns true if a compression program is available in PATH */
-static bool
-qemuCompressProgramAvailable(virQEMUSaveFormat compress)
-{
-    char *path;
-
-    if (compress == QEMU_SAVE_FORMAT_RAW)
-        return true;
-
-    if (!(path = virFindFileInPath(qemuSaveCompressionTypeToString(compress))))
-        return false;
-
-    VIR_FREE(path);
-    return true;
-}
-
 
 /* qemuGetCompressionProgram:
  * @imageFormat: String representation from qemu.conf for the compression
@@ -3289,6 +3273,7 @@ qemuGetCompressionProgram(const char *imageFormat,
                           bool use_raw_on_fail)
 {
     virQEMUSaveFormat ret;
+    char *path = NULL;
 
     if (!imageFormat)
         return QEMU_SAVE_FORMAT_RAW;
@@ -3296,9 +3281,11 @@ qemuGetCompressionProgram(const char *imageFormat,
     if ((ret = qemuSaveCompressionTypeFromString(imageFormat)) < 0)
         goto error;
 
-    if (!qemuCompressProgramAvailable(ret))
+    if (!(path = virFindFileInPath(imageFormat)))
         goto error;
 
+    VIR_FREE(path);
+
     return ret;
 
  error:
-- 
2.7.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]