From nobody Mon Feb 9 21:37:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1620745348; cv=none; d=zohomail.com; s=zohoarc; b=IEydGchXvAoDL9cMPdVClG8bF/bJpfA8trhWUAz3bCmm44DOqksQzFq2W2e3js5FP+OlAbqPzS/tiAxI/3hC66+KOo9LzpHNkF3H5TeQa3cBsdbiepTHm1oVIb2TDk9WtKPjRL4SIY99tdmKqqxWqySRa1B688MQGT4SePv4h+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620745348; h=Content-Type:Content-Transfer-Encoding:Cc: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=Lw1XM0XoK0Fv0He7om8Jk+XM7UbGttR3btshg2g/Dn8=; b=aIKKTIZn8Bz58YCJYatrOCpDhBOEZaH25IQuaN990/PXqpGiRZZmJIIMdjoZ+0UQJjNQF9Cdzp60tgRsMlN32EVh8NQ52fPROGpv+mawuf2rXJpgHSzSpbxOGt4oijQM4RQ3vrsbXBRGgL/0GmRXgPIYf3ga+WLg7qrzyA5Ncxc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1620745348839489.0093735174712; Tue, 11 May 2021 08:02:28 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-501-9JrczoIbN9-EyZq6OhAbDw-1; Tue, 11 May 2021 11:02:23 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B655E8C864C; Tue, 11 May 2021 15:02:13 +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 90EB213470; Tue, 11 May 2021 15:02:13 +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 4924155345; Tue, 11 May 2021 15:02:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14BF2BSP005578 for ; Tue, 11 May 2021 11:02:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 70D9D2B0B1; Tue, 11 May 2021 15:02:11 +0000 (UTC) Received: from work.redhat.com (ovpn-113-41.ams2.redhat.com [10.36.113.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8D1F1B427; Tue, 11 May 2021 15:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620745347; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Lw1XM0XoK0Fv0He7om8Jk+XM7UbGttR3btshg2g/Dn8=; b=YY0sRraEbk5DU4KnuQ1ISoxgwAaJ4dsfrrJr96rY87B8MOLZAsuG1bR5sPc6roRm+GDOI6 A7ofmjzXOjskp6zSzwLxzS5uhZZNgyP43KDKKdsB7C29R1ivUlTKTLpbYjEfEPIhHKctlX JPyZ5ksbW+sz7Dw6lTalHqmhjddERag= X-MC-Unique: 9JrczoIbN9-EyZq6OhAbDw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] virStoragePoolDefParseSource: Use virXMLProp* Date: Tue, 11 May 2021 17:01:55 +0200 Message-Id: <20210511150157.26027-9-twiederh@redhat.com> In-Reply-To: <20210511150157.26027-1-twiederh@redhat.com> References: <20210511150157.26027-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.11 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Laine Stump --- src/conf/storage_conf.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 328650bd6a..435a029b4e 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -531,7 +531,6 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, virStoragePoolOptions *options; int n; g_autoptr(virStorageAuthDef) authdef =3D NULL; - g_autofree char *port =3D NULL; g_autofree char *ver =3D NULL; g_autofree xmlNodePtr *nodeset =3D NULL; g_autofree char *sourcedir =3D NULL; @@ -580,16 +579,9 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, goto cleanup; } =20 - port =3D virXMLPropString(nodeset[i], "port"); - if (port) { - if (virStrToLong_i(port, NULL, 10, &source->hosts[i].port)= < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid port number: %s"), - port); - goto cleanup; - } - } - VIR_FREE(port); + if (virXMLPropInt(nodeset[i], "port", 10, VIR_XML_PROP_NONE, + &source->hosts[i].port, 0) < 0) + goto cleanup; } } =20 @@ -602,7 +594,6 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, goto cleanup; =20 for (i =3D 0; i < nsource; i++) { - g_autofree char *partsep =3D NULL; virStoragePoolSourceDevice dev =3D { .path =3D NULL }; dev.path =3D virXMLPropString(nodeset[i], "path"); =20 @@ -612,17 +603,11 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, goto cleanup; } =20 - partsep =3D virXMLPropString(nodeset[i], "part_separator"); - if (partsep) { - int value =3D virTristateBoolTypeFromString(partsep); - if (value <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid part_separator setting '%s'"), - partsep); - virStoragePoolSourceDeviceClear(&dev); - goto cleanup; - } - dev.part_separator =3D value; + if (virXMLPropTristateBool(nodeset[i], "part_separator", + VIR_XML_PROP_NONE, + &dev.part_separator) < 0) { + virStoragePoolSourceDeviceClear(&dev); + goto cleanup; } =20 if (VIR_APPEND_ELEMENT(source->devices, source->ndevice, dev) < 0)= { --=20 2.26.3