From nobody Sun Feb 8 00:26:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643403549; cv=none; d=zohomail.com; s=zohoarc; b=IpORIQeSsrzpYxykNf68d6tCJ/4tHVgPode7oH/im5e9+u3Rp6M/goSYEDwNlbZDDWmLda7nrp4kEKmMs00gmt92k8i6L+PV8yczInixcQ0u2gAzeLlQKv1E99SwvotoN4fKgKxTAAA7Kt3gvlJwFlVxJ+4ct+mR7PRDPGZ25y8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643403549; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F5pgZLe4c7UNcwEwe0ARvWkQxfO8/EcCTqDP/qSZ3HA=; b=CJmFwnykPoxJoWmUhvwvEPE7ugIb1VqWa4nrbYObBNZkeYei4A4yAEhj2e0AwgNzUOc8e8mvuylQZ8wtFhsH73tBdOQtzfwflo+QgTcG9qUMcZ27sSoYy5kH1miQ04rpykodJJHAqrlFCiOGAU9AgWDr6tb9B18Yyq7o8Tc/5Tc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16434035499631016.4160817206439; Fri, 28 Jan 2022 12:59:09 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-668-jsSJBjeLPuSaKAEe_SyFPg-1; Fri, 28 Jan 2022 15:59:05 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 691171083F6E; Fri, 28 Jan 2022 20:58:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AB3646974; Fri, 28 Jan 2022 20:58:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1B28B4A7C8; Fri, 28 Jan 2022 20:58:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20SKwrwS015486 for ; Fri, 28 Jan 2022 15:58:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id C4EA110631EB; Fri, 28 Jan 2022 20:58:53 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.192.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5DE410246F6 for ; Fri, 28 Jan 2022 20:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643403549; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=F5pgZLe4c7UNcwEwe0ARvWkQxfO8/EcCTqDP/qSZ3HA=; b=L/cdi4x2LwwlHxp2jLYq46fH2FzTjzgWA/PeuZQYX5czEk6zhec96WvbHOPZHtHkwkJDSO D41VAjIpMP8j3FIZJNPemo6W2yEyl+2J7TDlSdOE827jhn1CJNKcalmlEX+NIHJysqyMK9 H6DzsKplDZulK8qwN9Fo+UROsrcaPe0= X-MC-Unique: jsSJBjeLPuSaKAEe_SyFPg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] virParseVersionString: rename to virStringParseVersion Date: Fri, 28 Jan 2022 21:58:45 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643403551270100001 Signed-off-by: J=C3=A1n Tomko --- 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 lon= g *version) =20 uname(&ver); =20 - 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; } =20 - 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 *u= rl, return -1; } =20 - 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 *u= rl, return -1; } =20 - 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; =20 =20 # 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, u= nsigned long *version) if (virConnectGetVersionEnsureACL(conn) < 0) return -1; =20 - if (virParseVersionString(ver.release, version, true) < 0) { + if (virStringParseVersion(version, ver.release, true) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown release: %s"), v= er.release); return -1; } diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfil= ter_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) } =20 /* 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 =3D 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 *retvers= ion) if ((tmp =3D STRSKIP(tmp, "vzctl version ")) =3D=3D NULL) return -1; =20 - if (virParseVersionString(tmp, &version, true) < 0) + if (virStringParseVersion(&version, tmp, true) < 0) return -1; =20 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) =20 virSkipToDigit(&p); =20 - if (virParseVersionString(p, &version, true) < 0) + if (virStringParseVersion(&version, p, true) < 0) goto error; =20 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); =20 - 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) =20 =20 /** - * 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 =3D 0, micro =3D 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; =20 -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) =20 gVBoxAPI.UPFN.Utf16ToUtf8(vbox_driver->pFuncs, versionUtf16, &vboxVers= ion); =20 - if (virParseVersionString(vboxVersion, &vbox_driver->version, false) >= =3D 0) + if (virStringParseVersion(&vbox_driver->version, vboxVersion, false) >= =3D 0) ret =3D 0; =20 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, uns= igned long *version) return -1; } =20 - 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) } =20 tmp[0] =3D '\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; =20 - 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; =20 for (i =3D 0; i < G_N_ELEMENTS(versions); ++i) { - result =3D virParseVersionString(versions[i].string, &version, + result =3D virStringParseVersion(&version, versions[i].string, versions[i].allowMissing); =20 if (result !=3D versions[i].result) { diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-c= ommon.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); } =20 - if (virParseVersionString(uts.release, &thisversion, true) < 0) { + if (virStringParseVersion(&thisversion, uts.release, true) < 0) { virHostMsgFail(level, "%s", hint); return VIR_HOST_VALIDATE_FAILURE(level); } --=20 2.34.1