[libvirt PATCH 3/4] virParseVersionString: rename to virStringParseVersion

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

 



Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/bhyve/bhyve_driver.c                  | 2 +-
 src/ch/ch_conf.c                          | 2 +-
 src/esx/esx_vi.c                          | 8 ++++----
 src/libvirt_private.syms                  | 2 +-
 src/lxc/lxc_driver.c                      | 2 +-
 src/nwfilter/nwfilter_ebiptables_driver.c | 4 ++--
 src/openvz/openvz_conf.c                  | 2 +-
 src/util/virdnsmasq.c                     | 2 +-
 src/util/virfirewalld.c                   | 2 +-
 src/util/virstring.c                      | 7 ++++---
 src/util/virstring.h                      | 4 ++--
 src/vbox/vbox_common.c                    | 2 +-
 src/vmware/vmware_conf.c                  | 2 +-
 src/vz/vz_utils.c                         | 2 +-
 tests/testutilsqemu.c                     | 2 +-
 tests/utiltest.c                          | 2 +-
 tools/virt-host-validate-common.c         | 2 +-
 17 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index f291f12e50..f85f879abb 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -267,7 +267,7 @@ bhyveConnectGetVersion(virConnectPtr conn, unsigned long *version)
 
     uname(&ver);
 
-    if (virParseVersionString(ver.release, version, true) < 0) {
+    if (virStringParseVersion(version, ver.release, true) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unknown release: %s"), ver.release);
         return -1;
diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c
index be12934dcd..88a23a59cd 100644
--- a/src/ch/ch_conf.c
+++ b/src/ch/ch_conf.c
@@ -204,7 +204,7 @@ chExtractVersion(virCHDriver *driver)
         return -1;
     }
 
-    if (virParseVersionString(tmp, &version, true) < 0) {
+    if (virStringParseVersion(&version, tmp, true) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unable to parse cloud-hypervisor version: %s"), tmp);
         return -1;
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 80ed6199e3..bc43fa0af1 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -869,8 +869,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
         return -1;
     }
 
-    if (virParseVersionString(ctx->service->about->apiVersion,
-                              &ctx->apiVersion, true) < 0) {
+    if (virStringParseVersion(&ctx->apiVersion,
+                              ctx->service->about->apiVersion, true) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Could not parse VI API version '%s'"),
                        ctx->service->about->apiVersion);
@@ -884,8 +884,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
         return -1;
     }
 
-    if (virParseVersionString(ctx->service->about->version,
-                              &ctx->productVersion, true) < 0) {
+    if (virStringParseVersion(&ctx->productVersion,
+                              ctx->service->about->version, true) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Could not parse product version '%s'"),
                        ctx->service->about->version);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 38506c52c6..2d1896a995 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3302,7 +3302,6 @@ virStorageFileParseBackingStoreStr;
 
 
 # util/virstring.h
-virParseVersionString;
 virSkipSpaces;
 virSkipSpacesAndBackslash;
 virSkipSpacesBackwards;
@@ -3319,6 +3318,7 @@ virStringIsPrintable;
 virStringMatch;
 virStringMatchesNameSuffix;
 virStringParsePort;
+virStringParseVersion;
 virStringParseYesNo;
 virStringReplace;
 virStringSearch;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 7bc39120ee..8000871f7a 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1656,7 +1656,7 @@ static int lxcConnectGetVersion(virConnectPtr conn, unsigned long *version)
     if (virConnectGetVersionEnsureACL(conn) < 0)
         return -1;
 
-    if (virParseVersionString(ver.release, version, true) < 0) {
+    if (virStringParseVersion(version, ver.release, true) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown release: %s"), ver.release);
         return -1;
     }
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 0c420dd91f..058f2ec559 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -3656,7 +3656,7 @@ ebiptablesDriverProbeCtdir(void)
     }
 
     /* following Linux lxr, the logic was inverted in 2.6.39 */
-    if (virParseVersionString(utsname.release, &thisversion, true) < 0) {
+    if (virStringParseVersion(&thisversion, utsname.release, true) < 0) {
         VIR_ERROR(_("Could not determine kernel version from string %s"),
                   utsname.release);
         return;
@@ -3689,7 +3689,7 @@ ebiptablesDriverProbeStateMatchQuery(virFirewall *fw G_GNUC_UNUSED,
      * 'iptables v1.4.16'
      */
     if (!(tmp = strchr(lines[0], 'v')) ||
-        virParseVersionString(tmp + 1, version, true) < 0) {
+        virStringParseVersion(version, tmp + 1, true) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Cannot parse version string '%s'"),
                        lines[0]);
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index d2acbc2606..afdd97e3c9 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -86,7 +86,7 @@ openvzExtractVersionInfo(const char *cmdstr, int *retversion)
     if ((tmp = STRSKIP(tmp, "vzctl version ")) == NULL)
         return -1;
 
-    if (virParseVersionString(tmp, &version, true) < 0)
+    if (virStringParseVersion(&version, tmp, true) < 0)
         return -1;
 
     if (retversion)
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index b5f903cfac..68aaa83b2a 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -615,7 +615,7 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char *buf)
 
     virSkipToDigit(&p);
 
-    if (virParseVersionString(p, &version, true) < 0)
+    if (virStringParseVersion(&version, p, true) < 0)
         goto error;
 
     if (version < DNSMASQ_MIN_MAJOR * 1000000 + DNSMASQ_MIN_MINOR * 1000) {
diff --git a/src/util/virfirewalld.c b/src/util/virfirewalld.c
index 5a0a45f324..f467756f26 100644
--- a/src/util/virfirewalld.c
+++ b/src/util/virfirewalld.c
@@ -108,7 +108,7 @@ virFirewallDGetVersion(unsigned long *version)
     g_variant_get(reply, "(v)", &gvar);
     g_variant_get(gvar, "&s", &versionStr);
 
-    if (virParseVersionString(versionStr, version, false) < 0) {
+    if (virStringParseVersion(version, versionStr, false) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Failed to parse firewalld version '%s'"),
                        versionStr);
diff --git a/src/util/virstring.c b/src/util/virstring.c
index a7ce566963..ad0b158ad4 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -1022,9 +1022,9 @@ int virStringParseYesNo(const char *str, bool *result)
 
 
 /**
- * virParseVersionString:
- * @str: const char pointer to the version string
+ * virStringParseVersion:
  * @version: unsigned long pointer to output the version number
+ * @str: const char pointer to the version string
  * @allowMissing: true to treat 3 like 3.0.0, false to error out on
  * missing minor or micro
  *
@@ -1038,7 +1038,8 @@ int virStringParseYesNo(const char *str, bool *result)
  * Returns the 0 for success, -1 for error.
  */
 int
-virParseVersionString(const char *str, unsigned long *version,
+virStringParseVersion(unsigned long *version,
+                      const char *str,
                       bool allowMissing)
 {
     unsigned int major, minor = 0, micro = 0;
diff --git a/src/util/virstring.h b/src/util/virstring.h
index 1dbeb7445f..ec8ceb0022 100644
--- a/src/util/virstring.h
+++ b/src/util/virstring.h
@@ -136,6 +136,6 @@ int virStringParseYesNo(const char *str,
                         bool *result)
     G_GNUC_WARN_UNUSED_RESULT;
 
-int virParseVersionString(const char *str,
-                          unsigned long *version,
+int virStringParseVersion(unsigned long *version,
+                          const char *str,
                           bool allowMissing);
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index d3251863e6..eec47a02fc 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -170,7 +170,7 @@ vboxExtractVersion(void)
 
     gVBoxAPI.UPFN.Utf16ToUtf8(vbox_driver->pFuncs, versionUtf16, &vboxVersion);
 
-    if (virParseVersionString(vboxVersion, &vbox_driver->version, false) >= 0)
+    if (virStringParseVersion(&vbox_driver->version, vboxVersion, false) >= 0)
         ret = 0;
 
     gVBoxAPI.UPFN.Utf8Free(vbox_driver->pFuncs, vboxVersion);
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index c88f11fcab..bce690bbdf 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -230,7 +230,7 @@ vmwareParseVersionStr(int type, const char *verbuf, unsigned long *version)
         return -1;
     }
 
-    if (virParseVersionString(tmp, version, false) < 0) {
+    if (virStringParseVersion(version, tmp, false) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("version parsing error"));
         return -1;
diff --git a/src/vz/vz_utils.c b/src/vz/vz_utils.c
index 90e26091bb..fcf6d363a9 100644
--- a/src/vz/vz_utils.c
+++ b/src/vz/vz_utils.c
@@ -182,7 +182,7 @@ vzInitVersion(struct _vzDriver *driver)
     }
 
     tmp[0] = '\0';
-    if (virParseVersionString(sVer, &(driver->vzVersion), true) < 0) {
+    if (virStringParseVersion(&(driver->vzVersion), sVer, true) < 0) {
         vzParseError();
         goto cleanup;
     }
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index a77d1e6fe6..cf66c12622 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -696,7 +696,7 @@ testQemuGetLatestCapsForArch(const char *arch,
         if (!virStringStripSuffix(tmp, fullsuffix))
             continue;
 
-        if (virParseVersionString(tmp, &ver, false) < 0) {
+        if (virStringParseVersion(&ver, tmp, false) < 0) {
             VIR_TEST_DEBUG("skipping caps file '%s'", ent->d_name);
             continue;
         }
diff --git a/tests/utiltest.c b/tests/utiltest.c
index 2921ae8d8c..419dfea913 100644
--- a/tests/utiltest.c
+++ b/tests/utiltest.c
@@ -151,7 +151,7 @@ testParseVersionString(const void *data G_GNUC_UNUSED)
     unsigned long version;
 
     for (i = 0; i < G_N_ELEMENTS(versions); ++i) {
-        result = virParseVersionString(versions[i].string, &version,
+        result = virStringParseVersion(&version, versions[i].string,
                                        versions[i].allowMissing);
 
         if (result != versions[i].result) {
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index 1cb9d206b5..2ac96d1e19 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -267,7 +267,7 @@ int virHostValidateLinuxKernel(const char *hvname,
         return VIR_HOST_VALIDATE_FAILURE(level);
     }
 
-    if (virParseVersionString(uts.release, &thisversion, true) < 0) {
+    if (virStringParseVersion(&thisversion, uts.release, true) < 0) {
         virHostMsgFail(level, "%s", hint);
         return VIR_HOST_VALIDATE_FAILURE(level);
     }
-- 
2.34.1




[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]

  Powered by Linux