From nobody Mon Feb 9 19:53:20 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=1619020393; cv=none; d=zohomail.com; s=zohoarc; b=W5/SFcIGoU/ed5YlBjznrD0ZsJ9cDOsDX8i8uP9MQmNtiIx7h+Addec9D+jWvE6ewOhkPm2fg8UWIQC8jcU6KNzjiFcIEpoa2ppdLKzgMoIa17cAeCqqatInsk3ibur6L+6NH5SYos2WmiiFgr3eqvRJaT7FiKRkhWZsYjCsr74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020393; 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=S6L/ubH4DlDwYiSIgsyqMR2GaZyQMi4jwZSQpNRv0YE=; b=OMeV1DJoHGBk/7zsIKGeam5tlTwnDaNp17aDRr2SFi2MgbJ9iG3hInS1EmSDzNval4xSjD/5soXSQna5qn3xBGkVMZuee/fc/rVEof+EQlInRfhrt+p+kOlhkdr202VM0ZQu4dOzArHjA8ywr8isuMmTFyDnS5J3Y08QhB5xPw0= 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) header.from= 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 161902039336487.45476681016123; Wed, 21 Apr 2021 08:53:13 -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-390-PBmzzAAdNhe7SvudeP2fSw-1; Wed, 21 Apr 2021 11:52:07 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03F14188D6A1; Wed, 21 Apr 2021 15:51:56 +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 A91495D747; Wed, 21 Apr 2021 15:51:55 +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 75A3F1806D23; Wed, 21 Apr 2021 15:51:55 +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 13LFpjEn006912 for ; Wed, 21 Apr 2021 11:51:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id D398710016DB; Wed, 21 Apr 2021 15:51:45 +0000 (UTC) Received: from work.redhat.com (ovpn-112-172.ams2.redhat.com [10.36.112.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 248C11007610; Wed, 21 Apr 2021 15:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020392; 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=S6L/ubH4DlDwYiSIgsyqMR2GaZyQMi4jwZSQpNRv0YE=; b=I3GP89ODxWEQojonhRzaaO8msAZ733ZOuOKS3yvS3/UaAAZcrVWq2HUAgSSLw9sTSbqcMx nqlMmnMIVl/P+q2U975Nn8Vy1CAZCBL8OmfvNTw2Z3bTGNQe80ectSnHgn/WNPZuK/m78/ cDb90s055O6nnxoTAq/B67cevmlHm1E= X-MC-Unique: PBmzzAAdNhe7SvudeP2fSw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] virDomainHostdevSubsysSCSIHostDefParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 17:51:29 +0200 Message-Id: <20210421155133.162030-7-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.15 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 --- src/conf/domain_conf.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c1ed206119..eaa1398de1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7027,9 +7027,6 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr = sourcenode, virDomainXMLOption *xmlopt) { virDomainHostdevSubsysSCSIHost *scsihostsrc =3D &scsisrc->u.host; - g_autofree char *bus =3D NULL; - g_autofree char *target =3D NULL; - g_autofree char *unit =3D NULL; xmlNodePtr addressnode =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 @@ -7041,32 +7038,17 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePt= r sourcenode, return -1; } =20 - if (!(bus =3D virXMLPropString(addressnode, "bus")) || - !(target =3D virXMLPropString(addressnode, "target")) || - !(unit =3D virXMLPropString(addressnode, "unit"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("'bus', 'target', and 'unit' must be specified " - "for scsi hostdev source address")); - return -1; - } - - if (virStrToLong_uip(bus, NULL, 0, &scsihostsrc->bus) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse bus '%s'"), bus); + if (virXMLPropUInt(addressnode, "bus", 0, VIR_XML_PROP_REQUIRED, + &scsihostsrc->bus) < 0) return -1; - } =20 - if (virStrToLong_uip(target, NULL, 0, &scsihostsrc->target) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse target '%s'"), target); + if (virXMLPropUInt(addressnode, "target", 0, VIR_XML_PROP_REQUIRED, + &scsihostsrc->target) < 0) return -1; - } =20 - if (virStrToLong_ullp(unit, NULL, 0, &scsihostsrc->unit) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse unit '%s'"), unit); + if (virXMLPropULongLong(addressnode, "unit", 0, VIR_XML_PROP_REQUIRED, + &scsihostsrc->unit) < 0) return -1; - } =20 if (!(scsihostsrc->adapter =3D virXPathString("string(./adapter/@name)= ", ctxt))) { virReportError(VIR_ERR_XML_ERROR, "%s", --=20 2.26.3