From nobody Mon May 6 05:55:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15542955620563.913442344405439; Wed, 3 Apr 2019 05:46:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84962307D91F; Wed, 3 Apr 2019 12:46:00 +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 554A25C708; Wed, 3 Apr 2019 12:46:00 +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 1099641F3C; Wed, 3 Apr 2019 12:46:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x33CiwdA010683 for ; Wed, 3 Apr 2019 08:44:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1039F177C0; Wed, 3 Apr 2019 12:44:58 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C7475C237 for ; Wed, 3 Apr 2019 12:44:57 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 3 Apr 2019 14:44:50 +0200 Message-Id: <5174144b5594a2330845626399cfbeaeed76e77a.1554295433.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] util: Remove virPipeReadUntilEOF 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 03 Apr 2019 12:46:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Unused since 3c269b51a6f03a1a678e8d Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 - src/util/virutil.c | 82 ---------------------------------------- src/util/virutil.h | 3 -- 3 files changed, 86 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 23cbd27ce1..d61c772d1a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3225,7 +3225,6 @@ virMemoryMaxValue; virParseNumber; virParseOwnershipIds; virParseVersionString; -virPipeReadUntilEOF; virScaleInteger; virSetBlocking; virSetCloseExec; diff --git a/src/util/virutil.c b/src/util/virutil.c index 0d58f1ee57..c0acf59831 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -191,88 +191,6 @@ int virSetSockReuseAddr(int fd, bool fatal) } #endif -int -virPipeReadUntilEOF(int outfd, int errfd, - char **outbuf, char **errbuf) { - - struct pollfd fds[2]; - size_t i; - bool finished[2]; - - fds[0].fd =3D outfd; - fds[0].events =3D POLLIN; - fds[0].revents =3D 0; - finished[0] =3D false; - fds[1].fd =3D errfd; - fds[1].events =3D POLLIN; - fds[1].revents =3D 0; - finished[1] =3D false; - - while (!(finished[0] && finished[1])) { - - if (poll(fds, ARRAY_CARDINALITY(fds), -1) < 0) { - if ((errno =3D=3D EAGAIN) || (errno =3D=3D EINTR)) - continue; - goto pollerr; - } - - for (i =3D 0; i < ARRAY_CARDINALITY(fds); ++i) { - char data[1024], **buf; - int got, size; - - if (!(fds[i].revents)) - continue; - else if (fds[i].revents & POLLHUP) - finished[i] =3D true; - - if (!(fds[i].revents & POLLIN)) { - if (fds[i].revents & POLLHUP) - continue; - - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unknown poll response.")); - goto error; - } - - got =3D read(fds[i].fd, data, sizeof(data)); - - if (got =3D=3D sizeof(data)) - finished[i] =3D false; - - if (got =3D=3D 0) { - finished[i] =3D true; - continue; - } - if (got < 0) { - if (errno =3D=3D EINTR) - continue; - if (errno =3D=3D EAGAIN) - break; - goto pollerr; - } - - buf =3D ((fds[i].fd =3D=3D outfd) ? outbuf : errbuf); - size =3D (*buf ? strlen(*buf) : 0); - if (VIR_REALLOC_N(*buf, size+got+1) < 0) - goto error; - memmove(*buf+size, data, got); - (*buf)[size+got] =3D '\0'; - } - continue; - - pollerr: - virReportSystemError(errno, - "%s", _("poll error")); - goto error; - } - - return 0; - - error: - VIR_FREE(*outbuf); - VIR_FREE(*errbuf); - return -1; -} /* Convert C from hexadecimal character to integer. */ int diff --git a/src/util/virutil.h b/src/util/virutil.h index f8d8d85d27..a80e28b670 100644 --- a/src/util/virutil.h +++ b/src/util/virutil.h @@ -41,9 +41,6 @@ int virSetInherit(int fd, bool inherit) ATTRIBUTE_RETURN_= CHECK; int virSetCloseExec(int fd) ATTRIBUTE_RETURN_CHECK; int virSetSockReuseAddr(int fd, bool fatal) ATTRIBUTE_RETURN_CHECK; -int virPipeReadUntilEOF(int outfd, int errfd, - char **outbuf, char **errbuf); - int virSetUIDGID(uid_t uid, gid_t gid, gid_t *groups, int ngroups); int virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups, unsigned long long capBits, --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 05:55:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554295568135235.9209882242992; Wed, 3 Apr 2019 05:46:08 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id C070AC04FFF1; Wed, 3 Apr 2019 12:46:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9714760240; Wed, 3 Apr 2019 12:46:04 +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 493481803389; Wed, 3 Apr 2019 12:46:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x33CiwrV010691 for ; Wed, 3 Apr 2019 08:44:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id D48AE177C0; Wed, 3 Apr 2019 12:44:58 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D29A5C708 for ; Wed, 3 Apr 2019 12:44:58 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 3 Apr 2019 14:44:51 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] vmx: Remove unused variable in virVMXParseConfig 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 03 Apr 2019 12:46:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" cpumasklen is only ever written to. Remove it. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/vmx/vmx.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 8ffd5ff088..429630faaf 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1301,7 +1301,6 @@ virVMXParseConfig(virVMXContext *ctx, int unit; bool hgfs_disabled =3D true; long long sharedFolder_maxNum =3D 0; - int cpumasklen; struct virVMXConfigScanResults results =3D { -1 }; long long coresPerSocket =3D 0; virCPUDefPtr cpu =3D NULL; @@ -1504,8 +1503,6 @@ virVMXParseConfig(virVMXContext *ctx, const char *current =3D sched_cpu_affinity; int number, count =3D 0; - cpumasklen =3D 0; - def->cpumask =3D virBitmapNew(VIR_DOMAIN_CPUMASK_LEN); if (!def->cpumask) goto cleanup; @@ -1530,9 +1527,6 @@ virVMXParseConfig(virVMXContext *ctx, goto cleanup; } - if (number + 1 > cpumasklen) - cpumasklen =3D number + 1; - ignore_value(virBitmapSetBit(def->cpumask, number)); ++count; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 05:55:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554295569852831.7426860443329; Wed, 3 Apr 2019 05:46:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8EA04C1306F0; Wed, 3 Apr 2019 12:46:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65D885C880; Wed, 3 Apr 2019 12:46:08 +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 0BF45180338C; Wed, 3 Apr 2019 12:46:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x33CixI0010703 for ; Wed, 3 Apr 2019 08:44:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id A5E9F177C0; Wed, 3 Apr 2019 12:44:59 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D2E85C237 for ; Wed, 3 Apr 2019 12:44:59 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 3 Apr 2019 14:44:52 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] vmx: Refactor number parsing in virVMXParseConfig 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 03 Apr 2019 12:46:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Parsing of the cpu affinity list was using virParseNumber. Modernize it to get rid of the virParseNumber call. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/vmx/vmx.c | 56 ++++++++++++++++++--------------------------------- 1 file changed, 20 insertions(+), 36 deletions(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 429630faaf..70d9443766 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1500,43 +1500,35 @@ virVMXParseConfig(virVMXContext *ctx, } if (sched_cpu_affinity !=3D NULL && STRCASENEQ(sched_cpu_affinity, "al= l")) { - const char *current =3D sched_cpu_affinity; - int number, count =3D 0; + VIR_AUTOSTRINGLIST afflist =3D NULL; + char **aff; + size_t naffs; def->cpumask =3D virBitmapNew(VIR_DOMAIN_CPUMASK_LEN); if (!def->cpumask) goto cleanup; - while (*current !=3D '\0') { - virSkipSpaces(¤t); - - number =3D virParseNumber(¤t); - - if (number < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'sched.cpu.affinity'= to be " - "a comma separated list of unsigned integ= ers but " - "found '%s'"), sched_cpu_affinity); - goto cleanup; - } + if (!(afflist =3D virStringSplitCount(sched_cpu_affinity, ",", 0, = &naffs))) + goto cleanup; - if (number >=3D VIR_DOMAIN_CPUMASK_LEN) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("VMX entry 'sched.cpu.affinity' contains = a %d, " - "this value is too large"), number); - goto cleanup; - } + if (naffs < numvcpus) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'sched.cpu.affinity' to = contain " + "at least as many values as 'numvcpus' (%lld)= but " + "found only %zu value(s)"), numvcpus, naffs); + goto cleanup; + } - ignore_value(virBitmapSetBit(def->cpumask, number)); - ++count; + for (aff =3D afflist; *aff; aff++) { + const char *current =3D *aff; + unsigned int number; + int rc; + virSkipSpaces(¤t); + rc =3D virStrToLong_uip(current, (char **) ¤t, 10, &numb= er); virSkipSpaces(¤t); - if (*current =3D=3D ',') { - ++current; - } else if (*current =3D=3D '\0') { - break; - } else { + if (rc < 0 || *current !=3D '\0') { virReportError(VIR_ERR_INTERNAL_ERROR, _("Expecting VMX entry 'sched.cpu.affinity'= to be " "a comma separated list of unsigned integ= ers but " @@ -1544,15 +1536,7 @@ virVMXParseConfig(virVMXContext *ctx, goto cleanup; } - virSkipSpaces(¤t); - } - - if (count < numvcpus) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'sched.cpu.affinity' to = contain " - "at least as many values as 'numvcpus' (%lld)= but " - "found only %d value(s)"), numvcpus, count); - goto cleanup; + ignore_value(virBitmapSetBit(def->cpumask, number)); } } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 05:55:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554295573763190.6795337475237; Wed, 3 Apr 2019 05:46:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9904C821D8; Wed, 3 Apr 2019 12:46:12 +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 73E7517D4E; Wed, 3 Apr 2019 12:46:12 +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 28B9A3FB11; Wed, 3 Apr 2019 12:46:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x33Cj0Lb010711 for ; Wed, 3 Apr 2019 08:45:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 788735C237; Wed, 3 Apr 2019 12:45:00 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id F334C5C708 for ; Wed, 3 Apr 2019 12:44:59 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 3 Apr 2019 14:44:53 +0200 Message-Id: <2bc6f3438e5f9bf0d73abc4e25e708a8e912c73e.1554295433.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] rpc: ssh: Use virStrToLong_i instead of virParseNumber 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 03 Apr 2019 12:46:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/rpc/virnetlibsshsession.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c index b9143239b9..039d8a278c 100644 --- a/src/rpc/virnetlibsshsession.c +++ b/src/rpc/virnetlibsshsession.c @@ -157,6 +157,7 @@ static int virNetLibsshSessionOnceInit(void) { const char *dbgLevelStr; + int dbgLevel; if (!VIR_CLASS_NEW(virNetLibsshSession, virClassForObjectLockable())) return -1; @@ -172,10 +173,9 @@ virNetLibsshSessionOnceInit(void) #endif dbgLevelStr =3D virGetEnvAllowSUID("LIBVIRT_LIBSSH_DEBUG"); - if (dbgLevelStr) { - int dbgLevel =3D virParseNumber(&dbgLevelStr); + if (dbgLevelStr && + virStrToLong_i(dbgLevelStr, NULL, 10, &dbgLevel) >=3D 0) ssh_set_log_level(dbgLevel); - } return 0; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 05:55:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554295505074726.0532901619696; Wed, 3 Apr 2019 05:45:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B7872308426A; Wed, 3 Apr 2019 12:45:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 54A0618522; Wed, 3 Apr 2019 12:45:02 +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 DB3041803389; Wed, 3 Apr 2019 12:45:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x33Cj1hR010718 for ; Wed, 3 Apr 2019 08:45:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 48D6C5C237; Wed, 3 Apr 2019 12:45:01 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id C52055C883 for ; Wed, 3 Apr 2019 12:45:00 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 3 Apr 2019 14:44:54 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] util: Remove virParseNumber 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 03 Apr 2019 12:45:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We have more modern replacements. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 - src/util/virutil.c | 31 ------------------------------- src/util/virutil.h | 1 - 3 files changed, 33 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index d61c772d1a..72a378f21a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3222,7 +3222,6 @@ virIsSUID; virMemoryLimitIsSet; virMemoryLimitTruncate; virMemoryMaxValue; -virParseNumber; virParseOwnershipIds; virParseVersionString; virScaleInteger; diff --git a/src/util/virutil.c b/src/util/virutil.c index c0acf59831..3f214629ac 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -278,37 +278,6 @@ virScaleInteger(unsigned long long *value, const char = *suffix, } -/** - * virParseNumber: - * @str: pointer to the char pointer used - * - * Parse an unsigned number - * - * Returns the unsigned number or -1 in case of error. @str will be - * updated to skip the number. - */ -int -virParseNumber(const char **str) -{ - int ret =3D 0; - const char *cur =3D *str; - - if ((*cur < '0') || (*cur > '9')) - return -1; - - while (c_isdigit(*cur)) { - unsigned int c =3D *cur - '0'; - - if ((ret > INT_MAX / 10) || - ((ret =3D=3D INT_MAX / 10) && (c > INT_MAX % 10))) - return -1; - ret =3D ret * 10 + c; - cur++; - } - *str =3D cur; - return ret; -} - /** * virParseVersionString: * @str: const char pointer to the version string diff --git a/src/util/virutil.h b/src/util/virutil.h index a80e28b670..e537cc36cb 100644 --- a/src/util/virutil.h +++ b/src/util/virutil.h @@ -54,7 +54,6 @@ int virScaleInteger(unsigned long long *value, const char= *suffix, int virHexToBin(unsigned char c); -int virParseNumber(const char **str); int virParseVersionString(const char *str, unsigned long *version, bool allowMissing); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list