From nobody Fri May 17 11:58:44 2024 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=1618575715; cv=none; d=zohomail.com; s=zohoarc; b=N+TaMpgocup7jxsZa4UC0Ox+ugTOS6oGtXO4QWaQO5Ov/ldDaogqVjOG/HeUyvqjayXWYZf4xgF7WJT3Q0HKg6Kj3bpEi4aImmEZi38RJV8A9bIJePBA3jtyG8z+m1Titx0YqHFHYX7H0tLz5u21rPv1JzggX2OXnLCvtzbj7EE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575715; 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=NdLUKMWKmEd4dNp3EOIodlJbWtuz8aQZj70wLk0s7aU=; b=jLy/0pecJKNE1QtZPaftn5EI9vqJ+bAmONyvQX9lh7UBytv9EPkASQcr9R6ljrxQiA0S3+qILRWBmSuEkT6SYvx9YosdlyzHiL1KVFquMa3Efk1euFHRmWHyCvgGUrjvPgGzysW9aQtVM7dxcnxQUguuj8BjAnIYoNxynF/XXts= 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 1618575715210419.20680916992865; Fri, 16 Apr 2021 05:21:55 -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-97-d_0dxTK_Md-5O0G6MGwaOA-1; Fri, 16 Apr 2021 08:21:51 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3E87802B7F; Fri, 16 Apr 2021 12:21:45 +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 7CC5D646DC; Fri, 16 Apr 2021 12:21:45 +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 834F644A5E; Fri, 16 Apr 2021 12:21:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCL71c020577 for ; Fri, 16 Apr 2021 08:21:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 012D717C08; Fri, 16 Apr 2021 12:21:07 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D59B5D9E3; Fri, 16 Apr 2021 12:21:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575714; 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=NdLUKMWKmEd4dNp3EOIodlJbWtuz8aQZj70wLk0s7aU=; b=GkX5SyVQQVv99UIgFwZy0z7mABtvkWE1UXR1HusCgtTk+8hbpZoUPH/HvCTje/6wSyV+ML 3Ip0aKmBLj//toIrQ4ruPcSeEoQR6yWL5SFgn0PBLnSgi6iPGJpSySSZtVqphu6muMyfvb iZaMNX9QntHTh82hOcBnjIOiWpieR5g= X-MC-Unique: d_0dxTK_Md-5O0G6MGwaOA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] virDomainBackupDiskDefParseXML: Use virXMLProp* Date: Fri, 16 Apr 2021 14:20:51 +0200 Message-Id: <20210416122100.360154-2-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.13 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/backup_conf.c | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index 2de77a59c0..859609946f 100644 --- a/src/conf/backup_conf.c +++ b/src/conf/backup_conf.c @@ -106,10 +106,6 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node, g_autofree char *type =3D NULL; g_autofree char *format =3D NULL; g_autofree char *idx =3D NULL; - g_autofree char *backup =3D NULL; - g_autofree char *state =3D NULL; - g_autofree char *backupmode =3D NULL; - int tmp; xmlNodePtr srcNode; unsigned int storageSourceParseFlags =3D 0; bool internal =3D flags & VIR_DOMAIN_BACKUP_PARSE_INTERNAL; @@ -127,15 +123,9 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node, =20 def->backup =3D VIR_TRISTATE_BOOL_YES; =20 - if ((backup =3D virXMLPropString(node, "backup"))) { - if ((tmp =3D virTristateBoolTypeFromString(backup)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid disk 'backup' state '%s'"), backup); - return -1; - } - - def->backup =3D tmp; - } + if (virXMLPropTristateBool(node, "backup", VIR_XML_PROP_OPTIONAL, + &def->backup) < 0) + return -1; =20 /* don't parse anything else if backup is disabled */ if (def->backup =3D=3D VIR_TRISTATE_BOOL_NO) @@ -146,28 +136,18 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node, def->exportbitmap =3D virXMLPropString(node, "exportbitmap"); } =20 - if ((backupmode =3D virXMLPropString(node, "backupmode"))) { - if ((tmp =3D virDomainBackupDiskBackupModeTypeFromString(backupmod= e)) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid backupmode '%s' of disk '%s'"), - backupmode, def->name); - return -1; - } - - def->backupmode =3D tmp; - } + if (virXMLPropEnum(node, "backupmode", + virDomainBackupDiskBackupModeTypeFromString, + VIR_XML_PROP_OPTIONAL, &def->backupmode) < 0) + return -1; =20 def->incremental =3D virXMLPropString(node, "incremental"); =20 if (internal) { - if (!(state =3D virXMLPropString(node, "state")) || - (tmp =3D virDomainBackupDiskStateTypeFromString(state)) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("disk '%s' backup state wrong or missing'"), = def->name); + if (virXMLPropEnum(node, "state", + virDomainBackupDiskStateTypeFromString, + VIR_XML_PROP_REQUIRED, &def->state) < 0) return -1; - } - - def->state =3D tmp; } =20 type =3D virXMLPropString(node, "type"); --=20 2.26.2 From nobody Fri May 17 11:58:44 2024 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=1618575758; cv=none; d=zohomail.com; s=zohoarc; b=JEAykj2KeDGl7/MSvbrRdTa3vcif4xzTevX8TqcYyERkV3oWraetCtGaKWdErzM/WP5xvr8BW5CC8oItbN9LVj58SgQ4mT37MovDNRU/7WmZPVnnS2rMGhN5wtdJ7JtHKLg87RIpfgjvMf8ce5Ic90DUDw+sF41fOcPQwVin2tY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575758; 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=gnFv9JC9cmQpjm/tLFmkLgBnACqxNYiHdz6aZEt9eu8=; b=ihrAkL9ILXncJauzQx06/6jsTpI/0ixVhWTpsJvJza0liocDWUYXgFBx1RkRih8TiLP9VheRkosAuFV7Mbj17LoLLWxgFLKaAJINkck4QrhjUFpZ3x3jA/23oFI7Hq+15pwYgYdQXu/DDvXHR7HvhzwdsRk5PAgF0zD/rq9WFjA= 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 1618575758379494.2885548639606; Fri, 16 Apr 2021 05:22:38 -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-425-GRrewZLgNE29eeLqnALMmg-1; Fri, 16 Apr 2021 08:22:35 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 82A241854E31; Fri, 16 Apr 2021 12:22:29 +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 241CA104254C; Fri, 16 Apr 2021 12:22:29 +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 830141806D1D; Fri, 16 Apr 2021 12:22:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCL83b020595 for ; Fri, 16 Apr 2021 08:21:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D8015DEAD; Fri, 16 Apr 2021 12:21:08 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5374F5D9E3; Fri, 16 Apr 2021 12:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575757; 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=gnFv9JC9cmQpjm/tLFmkLgBnACqxNYiHdz6aZEt9eu8=; b=LxNIlM+qE/rfIe9fu4VehAmU61nbLcgKtaIXPDP8fbqVjSQM1+ac7+AcUswciACQLD/sU0 6vxKj4ZuWOLpsGXFCdYU8N89xUw2N2jCmThmTFELmylkxsQg43Y63/ywmM35EWwVzcTpc8 5BZvy8WD+mE7idHVWuzaE9OD1es4W/U= X-MC-Unique: GRrewZLgNE29eeLqnALMmg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] virDomainBackupDefParse: Use virXMLProp* Date: Fri, 16 Apr 2021 14:20:52 +0200 Message-Id: <20210416122100.360154-3-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.84 on 10.5.11.22 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/backup_conf.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index 859609946f..898725aac7 100644 --- a/src/conf/backup_conf.c +++ b/src/conf/backup_conf.c @@ -222,8 +222,6 @@ virDomainBackupDefParse(xmlXPathContextPtr ctxt, def->incremental =3D virXPathString("string(./incremental)", ctxt); =20 if ((node =3D virXPathNode("./server", ctxt))) { - g_autofree char *tls =3D NULL; - if (def->type !=3D VIR_DOMAIN_BACKUP_TYPE_PULL) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("use of requires pull mode backup")); @@ -249,18 +247,9 @@ virDomainBackupDefParse(xmlXPathContextPtr ctxt, return NULL; } =20 - if ((tls =3D virXMLPropString(node, "tls"))) { - int tmp; - - if ((tmp =3D virTristateBoolTypeFromString(tls)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("unknown value '%s' of 'tls' attribute"),\ - tls); - return NULL; - } - - def->tls =3D tmp; - } + if (virXMLPropTristateBool(node, "tls", VIR_XML_PROP_OPTIONAL, + &def->tls) < 0) + return NULL; } =20 if ((n =3D virXPathNodeSet("./disks/*", ctxt, &nodes)) < 0) --=20 2.26.2 From nobody Fri May 17 11:58:44 2024 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=1618575734; cv=none; d=zohomail.com; s=zohoarc; b=JId5oJ9UyjFyeZg3kQSwvPIIy2pQDdghigoEKvdqc6BRxTlVjzukotWe7xiARjQeh3IdA7CNKZnmmypo2M4qY9fuwHtzUhlMPSsZRFqK5Vv2P1KBus5lB4UfeprC8Zu8lxdCILe3Sdz/WlpeIRhtbbjdtP8z7SK6MvTD7/6Dvok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575734; 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=p1y/CJFJJ9boxBGQLfPADVnrR5YFP9gD1u1vJejJQ8s=; b=WANENbLhp0j5E/CtHV55Pt2/jTG+DKYCZUyG/QFYclC3TSXDS2hh61tYGWcc4N+nCgMa/G96rdPtaIn4h+Oamyh4Ru2hHwwd/wb/SHFGlti9AHZLAwH+5jM0dTEADOmtR0ZPQmyBbWQcozGiE3p12JYirkEj/JLwZD/cLAqwIck= 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 1618575734050666.321766979138; Fri, 16 Apr 2021 05:22:14 -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-511--2L70giKPZmAPD4ZISKSbQ-1; Fri, 16 Apr 2021 08:22:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C22E287A83B; Fri, 16 Apr 2021 12:22: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 A51DA614FF; Fri, 16 Apr 2021 12:22: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 6AF65180B763; Fri, 16 Apr 2021 12:22:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCL9WU020600 for ; Fri, 16 Apr 2021 08:21:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1A5B917C08; Fri, 16 Apr 2021 12:21:09 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E6FE5D9E3; Fri, 16 Apr 2021 12:21:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575733; 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=p1y/CJFJJ9boxBGQLfPADVnrR5YFP9gD1u1vJejJQ8s=; b=AlfE0eTu7ydEGqNy6r3Bg7fUGLTrfLRUROTYRDi04JtQacWlzhvlgiwOnpcFmJv9iwEeUy g1HnCXWH2QkhKwSKLygIAk3d5NVqFVfjVjlFGZ74OTs1mbp9D/c+6qDSLRIgot4w5HKO4l dlyauC0iL7Ig+VAe7akX9cvoa4OPoyA= X-MC-Unique: -2L70giKPZmAPD4ZISKSbQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] virZPCIDeviceAddressParseXML: Use virXMLProp* Date: Fri, 16 Apr 2021 14:20:53 +0200 Message-Id: <20210416122100.360154-4-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.13 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/device_conf.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 6a4b14cfda..8d3d012e4a 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -52,32 +52,21 @@ static int virZPCIDeviceAddressParseXML(xmlNodePtr node, virPCIDeviceAddress *addr) { - virZPCIDeviceAddress def =3D { .uid =3D { 0 }, .fid =3D { 0 } }; - g_autofree char *uid =3D NULL; - g_autofree char *fid =3D NULL; + int retUid, retFid; =20 - uid =3D virXMLPropString(node, "uid"); - fid =3D virXMLPropString(node, "fid"); + if ((retUid =3D virXMLPropUInt(node, "uid", 0, VIR_XML_PROP_OPTIONAL, + &addr->zpci.uid.value)) < 0) + return -1; =20 - if (uid) { - if (virStrToLong_uip(uid, NULL, 0, &def.uid.value) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'uid' attribute")); - return -1; - } - def.uid.isSet =3D true; - } + if (retUid > 0) + addr->zpci.uid.isSet =3D true; =20 - if (fid) { - if (virStrToLong_uip(fid, NULL, 0, &def.fid.value) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'fid' attribute")); - return -1; - } - def.fid.isSet =3D true; - } + if ((retFid =3D virXMLPropUInt(node, "fid", 0, VIR_XML_PROP_OPTIONAL, + &addr->zpci.fid.value)) < 0) + return -1; =20 - addr->zpci =3D def; + if (retFid > 0) + addr->zpci.fid.isSet =3D true; =20 return 0; } --=20 2.26.2 From nobody Fri May 17 11:58:44 2024 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=1618575721; cv=none; d=zohomail.com; s=zohoarc; b=HSosVGayYbNcJGoFCEkZMCOrDGOZLzDR1THWxIqBOKNrsWY64OWH0x5//opOhbqyebX+r1t4HT5IDL5BLfxk1yGQTzKO/uiQlfUqkV5fMNcPHdZwjGi+j1nGZR/v5ulz//0cRpO3LufGT31X+CoqYxsjQwjBd7rGl9neuTVtoOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575721; 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=gz8MoE/6NmIrB1g6Iqu35qIu7w3FQCMHI+bQ+psH/90=; b=Pb00omjZckz9soW1ZX4JDKusYTa7DPF/5JYN1r6l1+qlysmN7xd+SoQFpOa5hi+iMcoWUrDQ4HTQCCpu7HzVslgL3uxqHb05MmbbBXyUMp3a1jnwPYS6ASPoVTOrrliF+6u2mXNEspPS2PurnXdLxpu5aocKhFilEcpbaHwEzJk= 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 1618575721776255.91351439684672; Fri, 16 Apr 2021 05:22:01 -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-595-aEhccuxiOnSCO7o-FMMfdQ-1; Fri, 16 Apr 2021 08:21:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AE09D8189C6; Fri, 16 Apr 2021 12:21:52 +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 5BD39614FF; Fri, 16 Apr 2021 12:21:52 +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 2019844A62; Fri, 16 Apr 2021 12:21:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCLAId020610 for ; Fri, 16 Apr 2021 08:21:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 22C1817C08; Fri, 16 Apr 2021 12:21:10 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A6745D9C0; Fri, 16 Apr 2021 12:21:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575720; 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=gz8MoE/6NmIrB1g6Iqu35qIu7w3FQCMHI+bQ+psH/90=; b=IEVoAWpkgvOG+k76PXZl/FAeMIkU0WDJxZEn/Rs38YlLQ3dj0GcvHH+a7DHX9HxyYkwJn7 E9nHkOOxgvKIcrkBdg+D1BoXLtAPnrFB7LBH2qC6DJzNccLFIsl89YpGMRZooNRbyiTRXL oq8UBXAZ8EvzL86ARHl6RiKUnW9Nqp8= X-MC-Unique: aEhccuxiOnSCO7o-FMMfdQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] virPCIDeviceAddressParseXML: Use virXMLProp* Date: Fri, 16 Apr 2021 14:20:54 +0200 Message-Id: <20210416122100.360154-5-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.13 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/device_conf.c | 47 +++++++++++------------------------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 8d3d012e4a..951b7a348e 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -199,52 +199,29 @@ virPCIDeviceAddressParseXML(xmlNodePtr node, { xmlNodePtr cur; xmlNodePtr zpci =3D NULL; - g_autofree char *domain =3D virXMLPropString(node, "domain"); - g_autofree char *bus =3D virXMLPropString(node, "bus"); - g_autofree char *slot =3D virXMLPropString(node, "slot"); - g_autofree char *function =3D virXMLPropString(node, "function"); - g_autofree char *multi =3D virXMLPropString(node, "multifunction"); =20 memset(addr, 0, sizeof(*addr)); =20 - if (domain && - virStrToLong_uip(domain, NULL, 0, &addr->domain) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'domain' attribute")); + if (virXMLPropUInt(node, "domain", 0, VIR_XML_PROP_OPTIONAL, + &addr->domain) < 0) return -1; - } =20 - if (bus && - virStrToLong_uip(bus, NULL, 0, &addr->bus) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'bus' attribute")); + if (virXMLPropUInt(node, "bus", 0, VIR_XML_PROP_OPTIONAL, + &addr->bus) < 0) return -1; - } =20 - if (slot && - virStrToLong_uip(slot, NULL, 0, &addr->slot) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'slot' attribute")); + if (virXMLPropUInt(node, "slot", 0, VIR_XML_PROP_OPTIONAL, + &addr->slot) < 0) return -1; - } =20 - if (function && - virStrToLong_uip(function, NULL, 0, &addr->function) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'function' attribute")); + if (virXMLPropUInt(node, "function", 0, VIR_XML_PROP_OPTIONAL, + &addr->function) < 0) + return -1; + + if (virXMLPropTristateSwitch(node, "multifunction", VIR_XML_PROP_OPTIO= NAL, + &addr->multi) < 0) return -1; - } =20 - if (multi) { - int value; - if ((value =3D virTristateSwitchTypeFromString(multi)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown value '%s' for
'multifunct= ion' attribute"), - multi); - return -1; - } - addr->multi =3D value; - } if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(a= ddr, true)) return -1; =20 --=20 2.26.2 From nobody Fri May 17 11:58:44 2024 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=1618575725; cv=none; d=zohomail.com; s=zohoarc; b=VpmTHEgrCgwqyQC9v6Ny/QmYpSBIdeXLEYRfybHqSTl73FJrEUfNPVFlO21KT+ZdWmqwN2AmIxgucQ3SsfTxuxJQng/oQwLM0m7XESVf2T2ytO6L+Br21I+CgwSVYVsojXoI+SzQy0RQfSaFtSprO83vmbyHg6wCUkMZOlRN4/o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575725; 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=DBuR5s+HSwVzic/dlcmikeBXZzpTmF6FBhZdjFD6z7U=; b=CeUdvfjv7/KpdxYhy2rHmfFZP7Z/Ab78phQL0Ifol2Uo5zbARimcXECyaNI7dKSC68jr/Ao0ATPBfgpVjo/tdviv/bZODgPON2PIHlpGaVuIX3zwk2z5O/OjU4/c0Ncvz4AhB0Uc9vz4Ac1Jen+O8pOG6pNJ1Gj9U2nu4GqW3vs= 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 1618575725933748.805861790879; Fri, 16 Apr 2021 05:22:05 -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-175-Pf6UBptyMT-4BYbHlkabog-1; Fri, 16 Apr 2021 08:22:02 -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 C11486D241; Fri, 16 Apr 2021 12:21:55 +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 A3FFB669F2; Fri, 16 Apr 2021 12:21: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 6DCE51806D0F; Fri, 16 Apr 2021 12:21:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCLEs6020634 for ; Fri, 16 Apr 2021 08:21:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id A68325D9E3; Fri, 16 Apr 2021 12:21:14 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED6435D9C0; Fri, 16 Apr 2021 12:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575724; 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=DBuR5s+HSwVzic/dlcmikeBXZzpTmF6FBhZdjFD6z7U=; b=OPJHj6P+kES9Hj+1yU+vHwwG0owMGWFsZOfbscGS0Yl15CLmQeSHdk01xfguYN7om8qC4G CZQA0lOYi/ogp1WFOfTqeFuhi/5VvbP++v3OxqVMojzUy+mAfHn8Jmva613KbnyHAGxwcB ASC+CaBjU+w8+AQQy9G9pxCShV+cDCw= X-MC-Unique: Pf6UBptyMT-4BYbHlkabog-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] virDomainDeviceCCWAddressParseXML: Use virXMLProp* Date: Fri, 16 Apr 2021 14:20:55 +0200 Message-Id: <20210416122100.360154-6-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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/device_conf.c | 51 +++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 951b7a348e..621ff1b476 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -266,43 +266,34 @@ int virDomainDeviceCCWAddressParseXML(xmlNodePtr node, virDomainDeviceCCWAddress *addr) { - g_autofree char *cssid =3D virXMLPropString(node, "cssid"); - g_autofree char *ssid =3D virXMLPropString(node, "ssid"); - g_autofree char *devno =3D virXMLPropString(node, "devno"); + int cssid, ssid, devno; =20 memset(addr, 0, sizeof(*addr)); =20 + if ((cssid =3D virXMLPropUInt(node, "cssid", 0, VIR_XML_PROP_OPTIONAL, + &addr->cssid)) < 0) + return -1; + + if ((ssid =3D virXMLPropUInt(node, "ssid", 0, VIR_XML_PROP_OPTIONAL, + &addr->ssid)) < 0) + return -1; + + if ((devno =3D virXMLPropUInt(node, "devno", 0, VIR_XML_PROP_OPTIONAL, + &addr->devno)) < 0) + return -1; + + if (!virDomainDeviceCCWAddressIsValid(addr)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid specification for virtio ccw address: cs= sid=3D'%u' ssid=3D'%u' devno=3D'%u'"), + addr->cssid, addr->ssid, addr->devno); + return -1; + } + if (cssid && ssid && devno) { - if (cssid && - virStrToLong_uip(cssid, NULL, 0, &addr->cssid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'cssid' attribute")); - return -1; - } - if (ssid && - virStrToLong_uip(ssid, NULL, 0, &addr->ssid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'ssid' attribute")); - return -1; - } - if (devno && - virStrToLong_uip(devno, NULL, 0, &addr->devno) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'devno' attribute")); - return -1; - } - if (!virDomainDeviceCCWAddressIsValid(addr)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid specification for virtio ccw" - " address: cssid=3D'%s' ssid=3D'%s' devno=3D'= %s'"), - cssid, ssid, devno); - return -1; - } addr->assigned =3D true; } else if (cssid || ssid || devno) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Invalid partial specification for virtio ccw" - " address")); + _("Invalid partial specification for virtio ccw add= ress")); return -1; } =20 --=20 2.26.2 From nobody Fri May 17 11:58:44 2024 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=1618575727; cv=none; d=zohomail.com; s=zohoarc; b=bzn5wIWZKwhUJN5P3oJ01tu6jYphde/CpJnoamVbNXdR9acUh21LYvZs27ZSMQR7LU/AA2R8+d0ITDwpPtx5AIo6df/KSmaBVaRh00a9aVuxDwiXFGAPTu7nTzKsn7q5qHUGM2W/gySzprwXP4NcrAA4TFK6biX56D5OT0dfcOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575727; 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=LepJ+wazxH/HqYLywlys5c6X1YN+cIyCbOkiR8x6lbM=; b=L0gfISNqWPoibjsti2f2Dv8lm5IPSxi2jQlrYdkazaqlFTTvUwPdBu57GgrmSboDWb0P7FbnRnphk0AzuZiKZf2UToBiFdmaRyHyE7bnPKcAmHxFmB2ptQRLsMsuO+Z3P3MFU9bfBCTpc5pVHQJyuuNHdqZan2AKP893rdbg16Y= 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 161857572702223.832342143208734; Fri, 16 Apr 2021 05:22:07 -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-232-7kDgNikzMLm2c_uinfMlfw-1; Fri, 16 Apr 2021 08:22:03 -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 8AFE48189CA; Fri, 16 Apr 2021 12:21:58 +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 6BDCB69321; Fri, 16 Apr 2021 12:21: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 3564A1806D17; Fri, 16 Apr 2021 12:21:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCLFDb020643 for ; Fri, 16 Apr 2021 08:21:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id AEA295D9E3; Fri, 16 Apr 2021 12:21:15 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 030EB5D9C0; Fri, 16 Apr 2021 12:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575726; 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=LepJ+wazxH/HqYLywlys5c6X1YN+cIyCbOkiR8x6lbM=; b=M8OtdVKeY1VL3yKEK5cxKRvSUxEPkat2JI7qvfeCwP1Ch0XCpPgKY9fc5/MmdmggrixhYA Nb6jjfQ54cbqkDaQlelcBA7i0GfTKcFfDVjF2rQ/TuFt3ba1ETm6R/AyE4jPVfQgwnJ4Am I/Fl1lxBEiSvueXBlstWEhUIQK11HeQ= X-MC-Unique: 7kDgNikzMLm2c_uinfMlfw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] virDomainDeviceDriveAddressParseXML: Use virXMLProp* Date: Fri, 16 Apr 2021 14:20:56 +0200 Message-Id: <20210416122100.360154-7-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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/device_conf.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 621ff1b476..5a98cd8c0f 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -316,40 +316,23 @@ int virDomainDeviceDriveAddressParseXML(xmlNodePtr node, virDomainDeviceDriveAddress *addr) { - g_autofree char *controller =3D virXMLPropString(node, "controller"); - g_autofree char *bus =3D virXMLPropString(node, "bus"); - g_autofree char *target =3D virXMLPropString(node, "target"); - g_autofree char *unit =3D virXMLPropString(node, "unit"); - memset(addr, 0, sizeof(*addr)); =20 - if (controller && - virStrToLong_uip(controller, NULL, 10, &addr->controller) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'controller' attribute")); + if (virXMLPropUInt(node, "controller", 10, VIR_XML_PROP_OPTIONAL, + &addr->controller) < 0) return -1; - } =20 - if (bus && - virStrToLong_uip(bus, NULL, 10, &addr->bus) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'bus' attribute")); + if (virXMLPropUInt(node, "bus", 10, VIR_XML_PROP_OPTIONAL, + &addr->bus) < 0) return -1; - } =20 - if (target && - virStrToLong_uip(target, NULL, 10, &addr->target) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'target' attribute")); + if (virXMLPropUInt(node, "target", 10, VIR_XML_PROP_OPTIONAL, + &addr->target) < 0) return -1; - } =20 - if (unit && - virStrToLong_uip(unit, NULL, 10, &addr->unit) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'unit' attribute")); + if (virXMLPropUInt(node, "unit", 10, VIR_XML_PROP_OPTIONAL, + &addr->unit) < 0) return -1; - } =20 return 0; } --=20 2.26.2 From nobody Fri May 17 11:58:44 2024 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=1618575729; cv=none; d=zohomail.com; s=zohoarc; b=ZzgIhi7HJLmG2mMKbkUZeIeD2G/p8b9899N9KYaIR/t8bou8ByaTi29Q3BKtFbpmf5REGgk1+zgyyM1IpVlHEt5OINTrMJg7/SfGvt1a0vvZWQdoKEbDf4wE/aitKzHixIk5wiQuaOVcGLVwBe8YVvM0rBlco8LVLrX8fXlRoBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575729; 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=1lgLWViWUVgBvd2k26geGM371lrGdKtkedXf+Ipv1k4=; b=TSFa3R75qSJ6vyYiXmMRGKZwY8WUoxjF++7JNp9ITnXF2dolwFWurztSQaSW4J+K64vVExrqn0WJzqpPb6rZDiC0i2Sso3gFk2zL/H5KI8JMyNgpZ9ouYovmiC0ss7I5aI9E5M4XsMnRJt0vXupFMY71VrCFQpVk/vE7bgj0f6k= 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 1618575729170134.48746643198103; Fri, 16 Apr 2021 05:22:09 -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-510-uhDjDGQZPsa5Xf3_dRFEPQ-1; Fri, 16 Apr 2021 08:22:05 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7285910054F6; Fri, 16 Apr 2021 12:22:01 +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 48CFD10023AF; Fri, 16 Apr 2021 12:22:01 +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 0DCA544A62; Fri, 16 Apr 2021 12:22:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCLGBa020654 for ; Fri, 16 Apr 2021 08:21:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id BAC8317C08; Fri, 16 Apr 2021 12:21:16 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CDA35D9C0; Fri, 16 Apr 2021 12:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575728; 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=1lgLWViWUVgBvd2k26geGM371lrGdKtkedXf+Ipv1k4=; b=VFgb17W5kTiQipxI2K1EfP2DfXJh3KtBG7P3O5gWuYPCEpVk8lwTJs+ft5ttilmhGfmpca EzWtiSdQkQz+HixQOGCZecktDFTES4IaqPdaTJQz/fu2quKBVknbtj/KoO9snKS5UQFsgd o7Edw2/nA4n4HjCZFGH/x29nX3WOE0Y= X-MC-Unique: uhDjDGQZPsa5Xf3_dRFEPQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] virDomainDeviceVirtioSerialAddressParseXML: Use virXMLProp* Date: Fri, 16 Apr 2021 14:20:57 +0200 Message-Id: <20210416122100.360154-8-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.84 on 10.5.11.22 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/device_conf.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 5a98cd8c0f..587f966398 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -341,32 +341,19 @@ int virDomainDeviceVirtioSerialAddressParseXML(xmlNodePtr node, virDomainDeviceVirtioSerialAddr= ess *addr) { - g_autofree char *controller =3D virXMLPropString(node, "controller"); - g_autofree char *bus =3D virXMLPropString(node, "bus"); - g_autofree char *port =3D virXMLPropString(node, "port"); - memset(addr, 0, sizeof(*addr)); =20 - if (controller && - virStrToLong_uip(controller, NULL, 10, &addr->controller) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'controller' attribute")); + if (virXMLPropUInt(node, "controller", 10, VIR_XML_PROP_OPTIONAL, + &addr->controller) < 0) return -1; - } =20 - if (bus && - virStrToLong_uip(bus, NULL, 10, &addr->bus) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'bus' attribute")); + if (virXMLPropUInt(node, "bus", 10, VIR_XML_PROP_OPTIONAL, + &addr->bus) < 0) return -1; - } =20 - if (port && - virStrToLong_uip(port, NULL, 10, &addr->port) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'port' attribute")); + if (virXMLPropUInt(node, "port", 10, VIR_XML_PROP_OPTIONAL, + &addr->port) < 0) return -1; - } =20 return 0; } --=20 2.26.2 From nobody Fri May 17 11:58:44 2024 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=1618575733; cv=none; d=zohomail.com; s=zohoarc; b=giEm/VfJk6HLiCrkqidSfuf7XFvSEaKYcmVDVWET+6J1hXBMrOr4jrWQ00CoWMrdo8lNxaZqiFbAbUxnztgppaRGV5Qa+uyVGuG04CrvrVJ0Gqzq6N0YBhgsCv6H2WloKblrpC/uFg9MVNJENwkDns5tBSBTxBU0Sm8BNziPWxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575733; 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=sVmqGRYU/AF6ekZzUOpYF7yh58F5jj0i6ws07Jc5YjA=; b=PSFbiJkTQ1fUZTrbGVZtzW3lpM3XcsBRqDvBdlOPUGQDWtXgfNht7heSLv6PvKT1ZK9CYAWrR/FGzpkBr8Z+oBfz7dEDML3SUtisFfnpTz4uOwMVOS1OxoX0qJJ/fHtMqJkoorytA3KyPeYrop3VPtBkuxPu5wKkhCKtXesvmGg= 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 1618575733772360.58235769387034; Fri, 16 Apr 2021 05:22: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-40-tpaOQwf_PfSa3kgNahD0Ig-1; Fri, 16 Apr 2021 08:22:09 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2900107ACCD; Fri, 16 Apr 2021 12:22:04 +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 43FA419023; Fri, 16 Apr 2021 12:22: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 CF2CE44A6A; Fri, 16 Apr 2021 12:22:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCLH6d020660 for ; Fri, 16 Apr 2021 08:21:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id C4F8117C08; Fri, 16 Apr 2021 12:21:17 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 189375D9C0; Fri, 16 Apr 2021 12:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575732; 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=sVmqGRYU/AF6ekZzUOpYF7yh58F5jj0i6ws07Jc5YjA=; b=RGnZNkGi+gsoOa2i5grmbgykFMi30+0yGj57aHZTiPOhphmyCxTZLWqDaCz5lOQ9A1xaNd gwN3YE+bd70zn+VSCiy4cfYexINS0EPYwrPLGG8ZcoJLruMjtU29ZcLhUdpIU94NUmuBgM mZe/TwKeDql49949XvqGGmM75TdcMLk= X-MC-Unique: tpaOQwf_PfSa3kgNahD0Ig-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] virDomainDeviceCcidAddressParseXML: Use virXMLProp* Date: Fri, 16 Apr 2021 14:20:58 +0200 Message-Id: <20210416122100.360154-9-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.14 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/device_conf.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 587f966398..f7bf2de6f1 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -362,24 +362,15 @@ int virDomainDeviceCcidAddressParseXML(xmlNodePtr node, virDomainDeviceCcidAddress *addr) { - g_autofree char *controller =3D virXMLPropString(node, "controller"); - g_autofree char *slot =3D virXMLPropString(node, "slot"); - memset(addr, 0, sizeof(*addr)); =20 - if (controller && - virStrToLong_uip(controller, NULL, 10, &addr->controller) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'controller' attribute")); + if (virXMLPropUInt(node, "controller", 10, VIR_XML_PROP_OPTIONAL, + &addr->controller) < 0) return -1; - } =20 - if (slot && - virStrToLong_uip(slot, NULL, 10, &addr->slot) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'slot' attribute")); + if (virXMLPropUInt(node, "slot", 10, VIR_XML_PROP_OPTIONAL, + &addr->slot) < 0) return -1; - } =20 return 0; } --=20 2.26.2 From nobody Fri May 17 11:58:44 2024 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=1618575783; cv=none; d=zohomail.com; s=zohoarc; b=Zwo2x95Ki1ALTt3j0fD8xdqNQnvwkGw0Gc5VeoSqjWOBocH9lbADNuNEZCnkXvHr2Epzb4sAGjMaHFZiZSWQyhlIHWLiJwZ5VYrnMqrGd/fak+kjWMCNeUwS6OE2cbdKVZEzpn4UsXzGIuKP+yQgUcdnfHLPkSINainzY+VOuBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575783; 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=72HxAq8hWw4cP09JdRrpqAKM6FryJgIm/UYN4sE7Ppg=; b=J8PMATQd3lFbsBSKw2QR2xPbWeSEWzjcNaduCotYU9hkWrQTLuR0C+/cNQH0lQ370bOenqjoIhaaB0DSfo69YRwsGaTjylk7nAH9gvHl4LL4pGOYjZjRSqm/XJ5mUaQ8HDCrqzZWK6jPSkfaUMXfN7yVpNGsdw4fqlUHDrLyxpA= 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 161857578341288.15585471880718; Fri, 16 Apr 2021 05:23:03 -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-442-_KiyuPMHPp6zSm6t5BWZXA-1; Fri, 16 Apr 2021 08:22:15 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92FBD107ACF5; Fri, 16 Apr 2021 12:22:07 +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 6869E19715; Fri, 16 Apr 2021 12:22:07 +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 376E51806D1C; Fri, 16 Apr 2021 12:22:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCLIN8020672 for ; Fri, 16 Apr 2021 08:21:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id D0BB917C08; Fri, 16 Apr 2021 12:21:18 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23F905D9C0; Fri, 16 Apr 2021 12:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575782; 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=72HxAq8hWw4cP09JdRrpqAKM6FryJgIm/UYN4sE7Ppg=; b=AO6X5gAGqE5DPZtyJqGmKCnbMflDxKuCgK8ZRQX2MzhO0XcUfPj9bqpDknYQc4p4WPizTO xUvwUA3pvY6sOhef1FpMQxb+yF4F/DwfmgtJzWonnBvjDKol83yhRRbYqWaJe28NTMUlyg r59y9zRpdDhfyilkCMuDIRnu1RH/e0Y= X-MC-Unique: _KiyuPMHPp6zSm6t5BWZXA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] virDomainDeviceUSBAddressParseXML: Use virXMLProp* Date: Fri, 16 Apr 2021 14:20:59 +0200 Message-Id: <20210416122100.360154-10-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.84 on 10.5.11.23 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/device_conf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index f7bf2de6f1..1ce31e9234 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -403,19 +403,16 @@ virDomainDeviceUSBAddressParseXML(xmlNodePtr node, virDomainDeviceUSBAddress *addr) { g_autofree char *port =3D virXMLPropString(node, "port"); - g_autofree char *bus =3D virXMLPropString(node, "bus"); =20 memset(addr, 0, sizeof(*addr)); =20 if (port && virDomainDeviceUSBAddressParsePort(addr, port) < 0) return -1; =20 - if (bus && - virStrToLong_uip(bus, NULL, 10, &addr->bus) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'bus' attribute")); + if (virXMLPropUInt(node, "bus", 10, VIR_XML_PROP_OPTIONAL, + &addr->bus) < 0) return -1; - } + return 0; } =20 --=20 2.26.2 From nobody Fri May 17 11:58:44 2024 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=1618575795; cv=none; d=zohomail.com; s=zohoarc; b=igq9dxlIbBUT8ukK41z7mGj04OOtebowzxpR03yvsdhdPBr7wAtlT61JgnUdc0qb3JpTg6o3eOUbPzA+N+/4FJdWALYcT+5cVnFV0D+zKm4eVJ/kfSzKDCC+1dXcvTPLhpJk194WWHyThiCBUjDHAKWkJm22Lp5GdpicnSajLYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575795; 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=P1+9pC3cnYJapYH1ylLENzx05+fjQY2w93ho000LdLI=; b=OczN+N4zJCp1iZ/xYhOCNJAIjQTfgOd2cgjITcL+HxDMJMgHoSGhFJ4pm58JqSqssSJZ6u/1gUKNBv7OrBfFZ9zLwgtGPKiNcLOTtBQQ4rQeyh4+pd5nIEjrzc2th0lsbaAR+mRkWuP78BQaHhrfsSyD7w3QMaS3+M/Ss8N70GM= 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 1618575795525950.7798262995402; Fri, 16 Apr 2021 05:23:15 -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-548-QzMR5v_JNQOTtFGaxYiN5w-1; Fri, 16 Apr 2021 08:22:15 -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 5AF87107ACE4; Fri, 16 Apr 2021 12:22:10 +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 3D4E25B4B2; Fri, 16 Apr 2021 12:22:10 +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 CAA8744A6C; Fri, 16 Apr 2021 12:22:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCLJOd020693 for ; Fri, 16 Apr 2021 08:21:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id DBEFD5D9E3; Fri, 16 Apr 2021 12:21:19 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F85E5D9C0; Fri, 16 Apr 2021 12:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575794; 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=P1+9pC3cnYJapYH1ylLENzx05+fjQY2w93ho000LdLI=; b=HI7riJTgWPhmnGQByWl4BqArcAfFxFcWQCf4Hb1cUAmCaoA9mbWgbIkaMOAHB+p9q5MXam C0Vewj3BD6B+1HVm6mEyBGaiOFSi105+oAa+/MQePs+oHdO+oIkq8mZFdajcFCY4Z5NJE0 YT14w+Ctm77y0joh1AbSHRABveESzpo= X-MC-Unique: QzMR5v_JNQOTtFGaxYiN5w-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] virInterfaceLinkParseXML: Use virXMLProp* Date: Fri, 16 Apr 2021 14:21:00 +0200 Message-Id: <20210416122100.360154-11-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 --- src/conf/device_conf.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 1ce31e9234..a2893fec6f 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -468,28 +468,14 @@ int virInterfaceLinkParseXML(xmlNodePtr node, virNetDevIfLink *lnk) { - int state; - - g_autofree char *stateStr =3D virXMLPropString(node, "state"); - g_autofree char *speedStr =3D virXMLPropString(node, "speed"); - - if (stateStr) { - if ((state =3D virNetDevIfStateTypeFromString(stateStr)) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("unknown link state: %s"), - stateStr); - return -1; - } - lnk->state =3D state; - } + if (virXMLPropEnum(node, "state", virNetDevIfStateTypeFromString, + VIR_XML_PROP_OPTIONAL, &lnk->state) < 0) + return -1; =20 - if (speedStr && - virStrToLong_ui(speedStr, NULL, 10, &lnk->speed) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Unable to parse link speed: %s"), - speedStr); + if (virXMLPropUInt(node, "speed", 10, VIR_XML_PROP_OPTIONAL, + &lnk->speed) < 0) return -1; - } + return 0; } =20 --=20 2.26.2