]> xenbits.xensource.com Git - libvirt.git/commitdiff
virParseVersionString: rename to virStringParseVersion
authorJán Tomko <jtomko@redhat.com>
Sun, 23 Feb 2020 23:47:18 +0000 (00:47 +0100)
committerJán Tomko <jtomko@redhat.com>
Thu, 3 Feb 2022 13:10:03 +0000 (14:10 +0100)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
17 files changed:
src/bhyve/bhyve_driver.c
src/ch/ch_conf.c
src/esx/esx_vi.c
src/libvirt_private.syms
src/lxc/lxc_driver.c
src/nwfilter/nwfilter_ebiptables_driver.c
src/openvz/openvz_conf.c
src/util/virdnsmasq.c
src/util/virfirewalld.c
src/util/virstring.c
src/util/virstring.h
src/vbox/vbox_common.c
src/vmware/vmware_conf.c
src/vz/vz_utils.c
tests/testutilsqemu.c
tests/utiltest.c
tools/virt-host-validate-common.c

index 47ee98e6503e3a21ab627a37e579c88fcc8184e7..578fcfe1d2a288dba40bd74451b6d8f0f5797473 100644 (file)
@@ -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;
index be12934dcd8c4016ab67cf7c9133907fad08a712..88a23a59cd0e70316460717644a6aeb71be951ba 100644 (file)
@@ -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;
index 17401f0a3693b1c6e02849ae6f8e6249443c48e3..abfcccd91e3debe06644bacf8a4e6d4227321db9 100644 (file)
@@ -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);
index 2f6df7ada1ca8b67d6ad8e2bbe48038473db0229..f92ab0a5537fc29c7f8574e1123372fc20056c72 100644 (file)
@@ -3303,7 +3303,6 @@ virStorageFileParseBackingStoreStr;
 
 
 # util/virstring.h
-virParseVersionString;
 virSkipSpaces;
 virSkipSpacesAndBackslash;
 virSkipSpacesBackwards;
@@ -3320,6 +3319,7 @@ virStringIsPrintable;
 virStringMatch;
 virStringMatchesNameSuffix;
 virStringParsePort;
+virStringParseVersion;
 virStringParseYesNo;
 virStringReplace;
 virStringSearch;
index 42053de9c31f00be7c5271f015b44b965208a681..3d17b87e8cdee3b427c028eff01b596af19a9194 100644 (file)
@@ -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;
     }
index 0c420dd91f761dbacaea0c67031a89b22460f67b..058f2ec55946f7a1edeea3c46e06ec464fd9c9d3 100644 (file)
@@ -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]);
index d2acbc26067b036e1e02c013f0e444d75d59c63e..afdd97e3c9a6a8cb41392635cd34da4df82f63cd 100644 (file)
@@ -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)
index b5f903cfacf18ab39d470d1ad561d4b22a65be1c..68aaa83b2a12898c78f840e3abec2e68c788fee5 100644 (file)
@@ -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) {
index 5a0a45f32412522d919542d681a453ddde96543e..f467756f26a581863122cfefd37bfecba7890a6e 100644 (file)
@@ -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);
index a7ce5669633f56c1f78fed9bbaf2bc616317fd8f..ad0b158ad4dd1fc69ccdfe536c816fa2ca654eb6 100644 (file)
@@ -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;
index 1dbeb7445ff6390b4e7b3102b6642fe42dfd768f..ec8ceb0022b1376b94bf2471fa7882aded2f3611 100644 (file)
@@ -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);
index d3251863e6150d40274f94cad42962f7dcce2fa1..eec47a02fca0c4d8bf34035e3050d08cfd411674 100644 (file)
@@ -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);
index c88f11fcabf2ab6420575acca39f82be1bc5ad50..bce690bbdf89b610d395503b47fe1b6d48185987 100644 (file)
@@ -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;
index 90e26091bb5ee856f56212d5f1606bf20e352352..fcf6d363a92527fcc45d1811eca9623256a2caa9 100644 (file)
@@ -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;
     }
index a77d1e6fe64eabc241089ac573b906a6743487b1..cf66c12622de1bdd8e441c6ee2bde554f2e73670 100644 (file)
@@ -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;
         }
index 2921ae8d8c931ec1a92790de1ebd16d7ae2d8d21..419dfea91343ce2efbc568a334838641d03c3870 100644 (file)
@@ -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) {
index 1cb9d206b55c10ec2834e7ed70d0f1ea8cb9f529..2ac96d1e197e92eaa5549979c3fcf1301067e672 100644 (file)
@@ -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);
     }