From nobody Wed May 15 18:41:30 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=1619012039; cv=none; d=zohomail.com; s=zohoarc; b=N0mK6RUe00/fsD6J/c1NJHKLzxC8dttM4A1k1jqh9zPpjc4RNI2Od8qORe7AP0JwX0bLSnGNdlBQBYJEF4wFZy5AQrAnrtUIKg61bUZ9VoQALBzEzL2WSqt9wCF5gUoB7GJ3vi0nBud3ZceIGl8VRUM5qx3QDbp4qre6f+cdm50= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619012039; 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=YUfTqCxVM1cIVxPiSpfymNXIaMtCJ+FW3tuAls1OoHs=; b=NyRftcECXtI7RTqVRZcqOk7HYrCnbrbfPjubqpuqlWZNoxk2c58nOSkQNTMIgUw4R6z2jO7DtoDPlKg9431Vsj/ZOcHUIzbiAozyAaFb2MVnQglPgXCtlv9qAa6sH1mPUiN8E80Dsfb+5kzMvEW3rUOHcAStQop7DB2CrILVCBs= 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 1619012039922551.3231909162529; Wed, 21 Apr 2021 06:33:59 -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-IZ9lJJq6Pn24r-VrItMSiA-1; Wed, 21 Apr 2021 09:33:56 -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 A33E7343A9; Wed, 21 Apr 2021 13:33:46 +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 837226085A; Wed, 21 Apr 2021 13:33:46 +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 4BA5944A5E; Wed, 21 Apr 2021 13:33:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LDXbIJ019753 for ; Wed, 21 Apr 2021 09:33:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id D95605D747; Wed, 21 Apr 2021 13:33:37 +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 2DAD4627DC; Wed, 21 Apr 2021 13:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619012038; 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=YUfTqCxVM1cIVxPiSpfymNXIaMtCJ+FW3tuAls1OoHs=; b=XtaBMLEgBcEivSFn4KRXgWZEdQAas0DSKxX559ykyU83otUSC8Cz3fNnvJi7GqgdJC1Sku +Ojp+1VTNNYjXOGkc2zFsbkLLikPm3SYGknROW0YdJf83vwLlqGE8ZpYv7f3rLYBC1USSD jCRgKPIUaXz/FO5P/yhYVogG6PZTtVE= X-MC-Unique: IZ9lJJq6Pn24r-VrItMSiA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] virDomainVirtioOptionsParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 15:33:23 +0200 Message-Id: <20210421133332.59662-2-twiederh@redhat.com> In-Reply-To: <20210421133332.59662-1-twiederh@redhat.com> References: <20210421133332.59662-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9a0d1f9285..5c13d9946c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1602,45 +1602,22 @@ static int virDomainVirtioOptionsParseXML(xmlNodePtr driver, virDomainVirtioOptions **virtio) { - int val; - virDomainVirtioOptions *res; - g_autofree char *str =3D NULL; - if (*virtio || !driver) return 0; =20 *virtio =3D g_new0(virDomainVirtioOptions, 1); =20 - res =3D *virtio; - - if ((str =3D virXMLPropString(driver, "iommu"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("invalid iommu value")); - return -1; - } - res->iommu =3D val; - } - VIR_FREE(str); + if (virXMLPropTristateSwitch(driver, "iommu", VIR_XML_PROP_NONE, + &(*virtio)->iommu) < 0) + return -1; =20 - if ((str =3D virXMLPropString(driver, "ats"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("invalid ats value")); - return -1; - } - res->ats =3D val; - } - VIR_FREE(str); + if (virXMLPropTristateSwitch(driver, "ats", VIR_XML_PROP_NONE, + &(*virtio)->ats) < 0) + return -1; =20 - if ((str =3D virXMLPropString(driver, "packed"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("invalid packed value")); - return -1; - } - res->packed =3D val; - } + if (virXMLPropTristateSwitch(driver, "packed", VIR_XML_PROP_NONE, + &(*virtio)->packed) < 0) + return -1; =20 return 0; } --=20 2.26.3 From nobody Wed May 15 18:41:30 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=1619012033; cv=none; d=zohomail.com; s=zohoarc; b=d/BKaGgZo4xEEsw4sL0fg2qJKuY6nv8VzP+xTkW+Cjb2K1ivwOa6nWjEogApJ5e0j2Wss/wLjM5mJSkryaqr33x0f9HZy18BHjp4a2vNoSwBUBjj6TurX6qHgPOIP8RcSdUMHS21LI5klokQyHCMEohVE5CvSDT7AaX2mH4V3O4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619012033; 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=fKe2yawcY5iBbvZ9tmH/6WEj43i6ltBxmFga3zyLTv8=; b=myzwFMnLhPyAWD1j/9MMbfapfGTC8eU7WicY2YnAyWQQWsKH2Qc7IhjEL6j+sgMv66rINCx9q9b7MO6J9CJi83kS5VzS6z7Ifm4y4TE3Ddukkc1bBP0Yy1Uht09jYlPC1LDvr1/cIXtz/+gJZleS6drAfUWzcBWaqFkpBjdlvnA= 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 1619012033917697.496022916207; Wed, 21 Apr 2021 06:33:53 -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-6-HqRmTP83MCuO0WtdLzXw6Q-1; Wed, 21 Apr 2021 09:33:47 -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 CF34C343AD; Wed, 21 Apr 2021 13:33:41 +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 B019C59443; Wed, 21 Apr 2021 13:33:41 +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 71FF41806D1A; Wed, 21 Apr 2021 13:33:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LDXcq0019760 for ; Wed, 21 Apr 2021 09:33:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id E0D8E3A47; Wed, 21 Apr 2021 13:33:38 +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 357666268F; Wed, 21 Apr 2021 13:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619012032; 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=fKe2yawcY5iBbvZ9tmH/6WEj43i6ltBxmFga3zyLTv8=; b=RaKuGu6khD2klPqK7H7QtVv+6u4rQqCjjGFTgNvN05P6VPv+h5n8coUS1EeT+izvfVZm6o RU/TEtvXh1schhcmy4Dv+J2BQze4Tr1pvV0RHgOI3sxNs4c2szaxY41MCUoujKwkWAbviP tP+k281lwCAsOwozfEipf+NHK7uRO6Y= X-MC-Unique: HqRmTP83MCuO0WtdLzXw6Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] virDomainDeviceBootParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 15:33:24 +0200 Message-Id: <20210421133332.59662-3-twiederh@redhat.com> In-Reply-To: <20210421133332.59662-1-twiederh@redhat.com> References: <20210421133332.59662-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: Peter Krempa --- src/conf/domain_conf.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5c13d9946c..9113993bce 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6465,22 +6465,12 @@ static int virDomainDeviceBootParseXML(xmlNodePtr node, virDomainDeviceInfo *info) { - g_autofree char *order =3D NULL; g_autofree char *loadparm =3D NULL; =20 - if (!(order =3D virXMLPropString(node, "order"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing boot order attribute")); - return -1; - } - - if (virStrToLong_uip(order, NULL, 10, &info->bootIndex) < 0 || - info->bootIndex =3D=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("incorrect boot order '%s', expecting positive in= teger"), - order); + if (virXMLPropUInt(node, "order", 10, + VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO, + &info->bootIndex) < 0) return -1; - } =20 loadparm =3D virXMLPropString(node, "loadparm"); if (loadparm) { --=20 2.26.3 From nobody Wed May 15 18:41:30 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=1619012038; cv=none; d=zohomail.com; s=zohoarc; b=mC73ZPMlZlAV9GpMCm7GaY3ffWH3XyhT0XVR1iJpDOMbsJIRJ8QtRZ0he9A3rVOAIvk+midUulu5JaMcH/0jHO38M3tmBgDJpt4/MfzBzaNpLlI9GG34fiO84INZSkQoeLHUJN6XzGAIx5ibsBT0c6bUmr10jAZqZqtKkEGAMV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619012038; 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=+F3BgHfRZRJ13k3eMTc9DjIsp/MrcVs4RpHlzVRAhnU=; b=AVLBt1Dyr+ri4XcZVyitH7P7sQTqD7DZWmfWDOkq0689I9BJKKlwISr6o4HmNWWqjac+7fcl4+pGXxR5tE1MN28Exuz+SWrUhff4sNXatArLGAdBsWdhNK73UHIp+KkIiRoATX7TlUdLFy4yiTI7lGy8aQJsoQD+9x7pzFItlHc= 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 1619012038282830.5925161637055; Wed, 21 Apr 2021 06:33:58 -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-228-CnvsjwPNPt-dnyt0AJAkIA-1; Wed, 21 Apr 2021 09:33:50 -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 7134B107ACED; Wed, 21 Apr 2021 13:33:42 +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 4C85F60938; Wed, 21 Apr 2021 13:33:42 +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 06CF844A5C; Wed, 21 Apr 2021 13:33:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LDXdSc019768 for ; Wed, 21 Apr 2021 09:33:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id E32C75D747; Wed, 21 Apr 2021 13:33:39 +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 3D4DB627DC; Wed, 21 Apr 2021 13:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619012034; 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=+F3BgHfRZRJ13k3eMTc9DjIsp/MrcVs4RpHlzVRAhnU=; b=aFY5bb240DDRun9XZjG6vxPfRFLa/eMPAkBLgCbGquOO4q906RSUKbjq/4UqX3qxyr9hy+ aBZQ5RPfiDZDL1/ilEFgin0Z8g+iL0iRldfTcrLKSHxJ5AD0oylVewEsx911S44c5z8VCa JwYrbLxmpuK8iLrvd5rMVGU+ELhP678= X-MC-Unique: CnvsjwPNPt-dnyt0AJAkIA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] virDomainDeviceISAAddressParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 15:33:25 +0200 Message-Id: <20210421133332.59662-4-twiederh@redhat.com> In-Reply-To: <20210421133332.59662-1-twiederh@redhat.com> References: <20210421133332.59662-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9113993bce..b28265cf4f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6494,27 +6494,14 @@ static int virDomainDeviceISAAddressParseXML(xmlNodePtr node, virDomainDeviceISAAddress *addr) { - g_autofree char *iobase =3D NULL; - g_autofree char *irq =3D NULL; - memset(addr, 0, sizeof(*addr)); =20 - iobase =3D virXMLPropString(node, "iobase"); - irq =3D virXMLPropString(node, "irq"); - - if (iobase && - virStrToLong_uip(iobase, NULL, 16, &addr->iobase) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Cannot parse
'iobase' attribute")); + if (virXMLPropUInt(node, "iobase", 16, VIR_XML_PROP_NONE, + &addr->iobase) < 0) return -1; - } =20 - if (irq && - virStrToLong_uip(irq, NULL, 16, &addr->irq) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Cannot parse
'irq' attribute")); + if (virXMLPropUInt(node, "irq", 16, VIR_XML_PROP_NONE, &addr->irq) < 0) return -1; - } =20 return 0; } --=20 2.26.3 From nobody Wed May 15 18:41:30 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=1619012039; cv=none; d=zohomail.com; s=zohoarc; b=LhPobN76sVoORJxJqXO899SIlHcsijcDpGA50qVZ6UCMu2t3SuMShpOWlQuXlQiQheja8duYrASMVYrKzCokkekIWTb9ONE5SMaWN1ODjvofvTfOX3KUqMr7iul934VuDVeVmtznl6c45Ogbu9VyAOzL5a+TMG6bopB81PXXqP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619012039; 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=nBog6ktFH4X2QC4sKBhqf/uSGFD8Fb/qwtkJL4/29a4=; b=PtWpXW1Y+vvPFDtD2aACzo1OigAxBSw7olpJ/TuVrJQxZqYsJPQuZxM13y4h5FoJC+739sNFCmtoQtQbwkDX9G/ltn/kXJgYEFaRuLfzrbdKngTrhI4f0FpGYk5wgltK896I1lE+d20AUEDK62yJ2XUEg4NdR9cvzxL1fV+5lZg= 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 1619012039692397.5946601062577; Wed, 21 Apr 2021 06:33:59 -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-537-0TO1KTz9NImw0Twra-QNaQ-1; Wed, 21 Apr 2021 09:33:55 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A795A107ACF9; Wed, 21 Apr 2021 13:33:46 +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 831A7610F1; Wed, 21 Apr 2021 13:33:46 +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 4B2801806D1D; Wed, 21 Apr 2021 13:33:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LDXeUm019775 for ; Wed, 21 Apr 2021 09:33:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id EDB2F3A47; Wed, 21 Apr 2021 13:33:40 +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 426215D747; Wed, 21 Apr 2021 13:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619012038; 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=nBog6ktFH4X2QC4sKBhqf/uSGFD8Fb/qwtkJL4/29a4=; b=YX33U87JB8bXJD3+kMdq3hzh8M9L1+jxcbmhek3XR5YR8HcKhJ6OhIpVko9/yaEIfxOZH5 VOUm7i1wT0r45AlaP/U7Qr7U1h+OdGMj8uwGVpiC5GMpmTukrlXc8LCfun2bHwsTEbHuu6 qeaOZ6xeGe3e3rWJR/7mPEa8trPpMIM= X-MC-Unique: 0TO1KTz9NImw0Twra-QNaQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] virDomainDiskSourceNVMeParse: Use virXMLProp* Date: Wed, 21 Apr 2021 15:33:26 +0200 Message-Id: <20210421133332.59662-5-twiederh@redhat.com> In-Reply-To: <20210421133332.59662-1-twiederh@redhat.com> References: <20210421133332.59662-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-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: Peter Krempa --- src/conf/domain_conf.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b28265cf4f..6ea347e05b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8453,7 +8453,6 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node, g_autoptr(virStorageSourceNVMeDef) nvme =3D NULL; g_autofree char *type =3D NULL; g_autofree char *namespc =3D NULL; - g_autofree char *managed =3D NULL; xmlNodePtr address; =20 nvme =3D g_new0(virStorageSourceNVMeDef, 1); @@ -8484,16 +8483,9 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node, return -1; } =20 - if ((managed =3D virXMLPropString(node, "managed"))) { - int value; - if ((value =3D virTristateBoolTypeFromString(managed)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("malformed managed value '%s'"), - managed); - return -1; - } - nvme->managed =3D value; - } + if (virXMLPropTristateBool(node, "managed", VIR_XML_PROP_NONE, + &nvme->managed) < 0) + return -1; =20 if (!(address =3D virXPathNode("./address", ctxt))) { virReportError(VIR_ERR_XML_ERROR, "%s", --=20 2.26.3 From nobody Wed May 15 18:41:30 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=1619012046; cv=none; d=zohomail.com; s=zohoarc; b=hmxdssYKhKRW29qO0RjEhLXbB46ATaOCFShAk+fUqt0rjllfLA8fCPEaL2Pd/9vieAAD43VKxTOKqMNKC/3w/JV/zq5BkEEj3MpEbqKYQx39f6EQtEiNozzJ/eVN2yExCciACSFtfbP/BPiUlLhH7MdsG+O83DICg7KB+//oDO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619012046; 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=n6n5Anz8nTdvjNFf+ftmAzBTBXglchrlGp8JqUrBXQE=; b=WH6+PrNwwbegxIwtKx9ZRjUiec353j99bs4Gcpgj2GRm/4dORqvJ3we5Z/88HHHFurYF0lj7WdtXrv5v/cFYVobllX4ZvgAx4V4XBJXnqz9PArc45zZCzji1lpxhsMZ5ZZDEPuCP8mcg+wyKOC5OHa+68oeZtyx2vN1nvE+DUXk= 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 1619012045996336.99907909198475; Wed, 21 Apr 2021 06:34: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-159-u3n0MeiYN5GhEBx9147yIA-1; Wed, 21 Apr 2021 09:34:01 -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 33206807918; Wed, 21 Apr 2021 13:33:49 +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 0E4F65DDAD; Wed, 21 Apr 2021 13:33:49 +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 D24231806D21; Wed, 21 Apr 2021 13:33:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LDXiAc019793 for ; Wed, 21 Apr 2021 09:33:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 848E86362B; Wed, 21 Apr 2021 13:33:44 +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 CD50E62A0E; Wed, 21 Apr 2021 13:33:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619012044; 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=n6n5Anz8nTdvjNFf+ftmAzBTBXglchrlGp8JqUrBXQE=; b=N7tWe7LeziOVEYVfh6baZoikHI78ImU30TuJenEI/suATVOfHd9U8ingunCTdLFrovl8Lu DK3r2ms5z94WeCav64b5n4PlJgPG7GBTDLfeMEisQ3h7CLdfaPZ0Nnez4LMIVzktgyvQJf P1mwxrTB6IwbBFDSWvDfDcyhvc6/8VM= X-MC-Unique: u3n0MeiYN5GhEBx9147yIA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] virDomainChrSourceDefParseFile: Use virXMLProp* Date: Wed, 21 Apr 2021 15:33:27 +0200 Message-Id: <20210421133332.59662-6-twiederh@redhat.com> In-Reply-To: <20210421133332.59662-1-twiederh@redhat.com> References: <20210421133332.59662-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6ea347e05b..d10d697884 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11678,20 +11678,11 @@ static int virDomainChrSourceDefParseFile(virDomainChrSourceDef *def, xmlNodePtr source) { - g_autofree char *append =3D NULL; - def->data.file.path =3D virXMLPropString(source, "path"); =20 - if ((append =3D virXMLPropString(source, "append"))) { - int value; - if ((value =3D virTristateSwitchTypeFromString(append)) <=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid append attribute value '%s'"), - append); - return -1; - } - def->data.file.append =3D value; - } + if (virXMLPropTristateSwitch(source, "append", VIR_XML_PROP_NONE, + &def->data.file.append) < 0) + return -1; =20 return 0; } --=20 2.26.3 From nobody Wed May 15 18:41:30 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=1619012109; cv=none; d=zohomail.com; s=zohoarc; b=N/IA9DpHP+hR41dCn5fH8bbNBYVxrpESuWzp7ZO7l5/INZIVZb4Fj9puSreanaYsod8+NfqYxztsWN4txcyqs9lgQtu2KJt3xU8xaI/PXWkrFDVQZ2/OrqtfeasjAsAZupxikbVZiToweGL5Mov9lMQ1Nm+H0oTBEMopeM2RBGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619012109; 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=ixBhlSxeVUpeLfyYZ0uK2ug+eIlXT5ga+XqzeydcMos=; b=AzZ1mEw5Fq/EgOYTPUf00Q7sxRGKyi0Nbtc3WmSQJX+wHOn+KkEx7sXWnO6sodrRacm2HeBDDrAY+2dVPoko7ZW4OCodEkeuhXazoHPLFWql5C3lVfknUHpPZBuPOr1nqWhBRt29aBy3g8hYxhpJBgeBFXIgcfU4gdUtE1eK16c= 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 1619012109074992.9307702210521; Wed, 21 Apr 2021 06:35: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-541-7w1gw_0vOtyDO8RiB5lhyA-1; Wed, 21 Apr 2021 09:34:00 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F5371074645; Wed, 21 Apr 2021 13:33: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 E7EBC5C1B4; Wed, 21 Apr 2021 13:33:51 +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 A84F144A62; Wed, 21 Apr 2021 13:33:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LDXj9w019800 for ; Wed, 21 Apr 2021 09:33:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8C320669EB; Wed, 21 Apr 2021 13:33: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 D4FE76362B; Wed, 21 Apr 2021 13:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619012107; 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=ixBhlSxeVUpeLfyYZ0uK2ug+eIlXT5ga+XqzeydcMos=; b=aL44uoxH85LGhNboV8+mSFrG9Egdg4Tl6V58v/XzKlVjv4pdjYtb2BiKycfVXWJDA8iBZz h6SI33R/FNP+gt2ee4y5I92ftmMeln0orIfk3RjhRJmDMiNGuZbQm9dTiVEfu7+p6tTVux 5qc0sXRqgseW3rGp4fUuz8fwxbqQBPc= X-MC-Unique: 7w1gw_0vOtyDO8RiB5lhyA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] virDomainChrSourceDefParseLog: Use virXMLProp* Date: Wed, 21 Apr 2021 15:33:28 +0200 Message-Id: <20210421133332.59662-7-twiederh@redhat.com> In-Reply-To: <20210421133332.59662-1-twiederh@redhat.com> References: <20210421133332.59662-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.16 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: Peter Krempa --- src/conf/domain_conf.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d10d697884..c97a062d1f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11713,20 +11713,11 @@ static int virDomainChrSourceDefParseLog(virDomainChrSourceDef *def, xmlNodePtr log) { - g_autofree char *append =3D NULL; - def->logfile =3D virXMLPropString(log, "file"); =20 - if ((append =3D virXMLPropString(log, "append"))) { - int value; - if ((value =3D virTristateSwitchTypeFromString(append)) <=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid append attribute value '%s'"), - append); - return -1; - } - def->logappend =3D value; - } + if (virXMLPropTristateSwitch(log, "append", VIR_XML_PROP_NONE, + &def->logappend) < 0) + return -1; =20 return 0; } --=20 2.26.3 From nobody Wed May 15 18:41:30 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=1619012049; cv=none; d=zohomail.com; s=zohoarc; b=Eg+QrH9IgG3JR/y0I0DfMjHFPXCVlJNeJCFt9ynNg1RerD8Sxlx67ixX6aM7CD7zNURVcWjOSfXgA/PRiCduEuE8Bk7FxpEcH1TWjYS15GxwQHrUOj1t9iU4KkxswXk6KpaqBkTW+Hegz/3K6LarP9T3tsxSkqM0JoIRNCbS2JA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619012049; 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=EbNWf2NzGkEihJDE+B6W6Lpc2b7b0/NgF9PNHyiBrG0=; b=ToaTCuRWZggLd1bCUd981IhxtyyMKqPP6amaf1ii3VIo+uh8d6zmDkoVf5RyGRBUwixmULp2+1NZLzXpaRXJkEhHAl2gde5Uhsq2j7XzhIlCE6cs+zPMriHB+lwqBtYJ8fzsCHGjFo7WG3GjI0W6qt3fTolkc2n2wQQ9ro31b6w= 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 1619012049374814.1598885229074; Wed, 21 Apr 2021 06:34: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-579-IbI6lQFSN1Ori0MYpXxf5A-1; Wed, 21 Apr 2021 09:34:05 -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 37CE583DE6C; Wed, 21 Apr 2021 13:33:55 +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 1045C5DAA5; Wed, 21 Apr 2021 13:33: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 C41EE44A6A; Wed, 21 Apr 2021 13:33:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LDXkZZ019808 for ; Wed, 21 Apr 2021 09:33:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 96DFA63634; Wed, 21 Apr 2021 13:33:46 +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 DD617629C0; Wed, 21 Apr 2021 13:33:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619012048; 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=EbNWf2NzGkEihJDE+B6W6Lpc2b7b0/NgF9PNHyiBrG0=; b=JVqhfgwKd6rMTAJbOFrQVUCcfUKcGzDMYyC2+lYh/3kOHTbBy1sOmoiwmf78OhG41Xo8o5 tGcO6xpP3Vzz0ja87nursm4lsVdnGMC5ECxpyU0HXMQ1ubxTHsEybvExNtKXat5H754LcF tebswUEWtPsoHpg6xurM/VxsLecpcpc= X-MC-Unique: IbI6lQFSN1Ori0MYpXxf5A-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] virDomainAudioJackParse: Use virXMLProp* Date: Wed, 21 Apr 2021 15:33:29 +0200 Message-Id: <20210421133332.59662-8-twiederh@redhat.com> In-Reply-To: <20210421133332.59662-1-twiederh@redhat.com> References: <20210421133332.59662-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c97a062d1f..ec7d48b40e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13806,19 +13806,13 @@ static int virDomainAudioJackParse(virDomainAudioIOJack *def, xmlNodePtr node) { - g_autofree char *exactName =3D virXMLPropString(node, "exactName"); - def->serverName =3D virXMLPropString(node, "serverName"); def->clientName =3D virXMLPropString(node, "clientName"); def->connectPorts =3D virXMLPropString(node, "connectPorts"); =20 - if (exactName && - ((def->exactName =3D - virTristateBoolTypeFromString(exactName)) <=3D 0)) { - virReportError(VIR_ERR_XML_ERROR, - _("unknown 'exactName' value '%s'"), exactName); + if (virXMLPropTristateBool(node, "exactName", VIR_XML_PROP_NONE, + &def->exactName) < 0) return -1; - } =20 return 0; } --=20 2.26.3 From nobody Wed May 15 18:41:30 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=1619012043; cv=none; d=zohomail.com; s=zohoarc; b=c9bEg4Vgxwrahp1tXPBw9w++LW2+mUWZi7sxGErdBpiD1AehN51NjttO/O3ZBtjgPcurzqXkI+X6Ly8SAMDF5mqKY1rrXibKCPBuGw1/Al6N0aISPTmy0psUscuwAbihzZ/u/XPDNfo8p4D/xhU5+OjKuB+KzG9jbe1Y+nzVkU8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619012043; 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=NZEYOTOEzf5KAg+uDjT+Kmp8TmLFyYaYtEVV4XFjuM0=; b=b4DiPzMf9LKvH4bzF9fu0RNFUsMFNFtn0C2Lg7neUt/DcUQ61cBN2ymjEuyUNfgudxvTZKb8jvnygrBEjCqIGQ+0vKgpvGc8CRi3xrmaoRchI9DwrmDf2kONthtrViiBYWW2KqHoMX2TRKyZBslH03a0LfZXgJWMIVYuirFxnFw= 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 1619012043760223.3520204837488; Wed, 21 Apr 2021 06:34: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-541-LuN0BWRnPle9D09MjDTNDw-1; Wed, 21 Apr 2021 09:34:00 -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 7E644107464C; Wed, 21 Apr 2021 13:33: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 5FC3B50F1A; Wed, 21 Apr 2021 13:33: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 1668444A64; Wed, 21 Apr 2021 13:33:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LDXlMn019816 for ; Wed, 21 Apr 2021 09:33:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9BFF86362B; Wed, 21 Apr 2021 13:33:47 +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 E7E39629C0; Wed, 21 Apr 2021 13:33:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619012042; 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=NZEYOTOEzf5KAg+uDjT+Kmp8TmLFyYaYtEVV4XFjuM0=; b=AKmA+SwdkBclHcOvjqKMq2pTpCWlOUupDF0u7Af9xiHRAy+EYkIwWZB8hFtDs3HOd0Ypf3 laeBQQxfLbt3fSmMlXGzrmMVZ7LxK3dSxOePfnPxGxhTdqzRSscMQj+jLcMrk0nTL2W4xn RjVX640BpWTq46yWBT0GHztqCD58spE= X-MC-Unique: LuN0BWRnPle9D09MjDTNDw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] virDomainVideoResolutionDefParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 15:33:30 +0200 Message-Id: <20210421133332.59662-9-twiederh@redhat.com> In-Reply-To: <20210421133332.59662-1-twiederh@redhat.com> References: <20210421133332.59662-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: Peter Krempa --- src/conf/domain_conf.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ec7d48b40e..9e968c087d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14914,31 +14914,14 @@ static virDomainVideoResolutionDef * virDomainVideoResolutionDefParseXML(xmlNodePtr node) { g_autofree virDomainVideoResolutionDef *def =3D NULL; - g_autofree char *x =3D NULL; - g_autofree char *y =3D NULL; - - x =3D virXMLPropString(node, "x"); - y =3D virXMLPropString(node, "y"); - - if (!x || !y) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("missing values for resolution")); - return NULL; - } =20 def =3D g_new0(virDomainVideoResolutionDef, 1); =20 - if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("cannot parse video x-resolution '%s'"), x); + if (virXMLPropUInt(node, "x", 10, VIR_XML_PROP_REQUIRED, &def->x) < 0) return NULL; - } =20 - if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("cannot parse video y-resolution '%s'"), y); + if (virXMLPropUInt(node, "y", 10, VIR_XML_PROP_REQUIRED, &def->y) < 0) return NULL; - } =20 return g_steal_pointer(&def); } --=20 2.26.3 From nobody Wed May 15 18:41:30 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=1619012055; cv=none; d=zohomail.com; s=zohoarc; b=IS1/BpSq5LKSMRXGDAI0bTp8yvq1lShbthp94RlrJJwH24buWh26EGAecQa/jtVwb5tqzk2E+tQP9x0Xz4jlz3bQBk6Mgvtos8fMhfaSsy+EGburABEOLNmxfHaHHBo3zdV5KAS/FHvxODLib8rgXmtWqHrr4TEUZQsMoV7iHgU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619012055; 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=cIDyiYAe2RoVZmryt6/kGaeZgO3lT8RApHbgDeqS874=; b=j0v24koMiGGmMD31IPcz9PeDQw/ZLAHIQMtyveJKEM7EB64mqNkIbi3VVZIOFTLceW63+3LVp4fbhzaYRG38SfmSA4o9rj65D7W2gXcqH9mehGFpKPrRPOsJPczPQkDS5tDOI+YAjsZHfe57f8xTCUuz3NDYwb6g5mPRCKPenEY= 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 1619012055885172.3249759747007; Wed, 21 Apr 2021 06:34: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-510-VOuK0Li1PZ6sr4yqRxSNNA-1; Wed, 21 Apr 2021 09:34:02 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 778568030CA; Wed, 21 Apr 2021 13:33:55 +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 51CFC610F3; Wed, 21 Apr 2021 13:33: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 1786F44A6C; Wed, 21 Apr 2021 13:33:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LDXmaW019825 for ; Wed, 21 Apr 2021 09:33:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id A2C3762A0E; Wed, 21 Apr 2021 13:33:48 +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 EC447669EB; Wed, 21 Apr 2021 13:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619012054; 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=cIDyiYAe2RoVZmryt6/kGaeZgO3lT8RApHbgDeqS874=; b=CMp9s4YI8OdbCAGKPk+8R1+HOEWhTKBAimXavpipYxMROFURt81UAj58WwZcBGjrXeakJ4 e4iB39BRNEucP/dibv21U6otxU17XnbSyJ0ed+FGNbJS9BWf/f+rikSM/2H/z5IN+YW3tw gIV+PS5l0KT11WrBz6AgFZZnn6Sljo8= X-MC-Unique: VOuK0Li1PZ6sr4yqRxSNNA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] virDomainVsockDefParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 15:33:31 +0200 Message-Id: <20210421133332.59662-10-twiederh@redhat.com> In-Reply-To: <20210421133332.59662-1-twiederh@redhat.com> References: <20210421133332.59662-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-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: Peter Krempa --- src/conf/domain_conf.c | 48 ++++++++++++------------------------------ 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9e968c087d..1878d9ed9d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15855,8 +15855,6 @@ virDomainVsockDefParseXML(virDomainXMLOption *xmlop= t, { VIR_XPATH_NODE_AUTORESTORE(ctxt) xmlNodePtr cid; - int val; - g_autofree char *tmp =3D NULL; g_autoptr(virDomainVsockDef) vsock =3D NULL; =20 ctxt->node =3D node; @@ -15864,49 +15862,29 @@ virDomainVsockDefParseXML(virDomainXMLOption *xml= opt, if (!(vsock =3D virDomainVsockDefNew(xmlopt))) return NULL; =20 - if ((tmp =3D virXMLPropString(node, "model"))) { - if ((val =3D virDomainVsockModelTypeFromString(tmp)) < 0) { - virReportError(VIR_ERR_XML_ERROR, _("unknown vsock model: %s")= , tmp); - return NULL; - } - vsock->model =3D val; - } - - cid =3D virXPathNode("./cid", ctxt); + if (virXMLPropEnum(node, "model", virDomainVsockModelTypeFromString, + VIR_XML_PROP_NONE, &vsock->model) < 0) + return NULL; =20 - VIR_FREE(tmp); - if (cid) { - if ((tmp =3D virXMLPropString(cid, "address"))) { - if (virStrToLong_uip(tmp, NULL, 10, &vsock->guest_cid) < 0 || - vsock->guest_cid =3D=3D 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("'cid' attribute must be a positive numbe= r: %s"), - tmp); - return NULL; - } - } + if ((cid =3D virXPathNode("./cid", ctxt))) { + if (virXMLPropUInt(cid, "address", 10, + VIR_XML_PROP_NONE | VIR_XML_PROP_NONZERO, + &vsock->guest_cid) < 0) + return NULL; =20 - VIR_FREE(tmp); - if ((tmp =3D virXMLPropString(cid, "auto"))) { - val =3D virTristateBoolTypeFromString(tmp); - if (val <=3D 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("'auto' attribute can be 'yes' or 'no': %= s"), - tmp); - return NULL; - } - vsock->auto_cid =3D val; - } + if (virXMLPropTristateBool(cid, "auto", VIR_XML_PROP_NONE, + &vsock->auto_cid) < 0) + return NULL; } =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &vsock->info, flag= s) < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &vsock->info, + flags) < 0) return NULL; =20 if (virDomainVirtioOptionsParseXML(virXPathNode("./driver", ctxt), &vsock->virtio) < 0) return NULL; =20 - return g_steal_pointer(&vsock); } =20 --=20 2.26.3 From nobody Wed May 15 18:41:30 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=1619012050; cv=none; d=zohomail.com; s=zohoarc; b=cKUk5RSYEZPKVubq/a0+xeUfwylo+PK6s0YrUwPNyQ/L1gMYeMFVf0lPZtsLA+7XWgHq2k8mivMep8ThN3xV22UK0taoLRbrtp70j1TfNF81AbaKZ67IqU1EtJmCPdNNaIIVmDyZRyBqLtrBCmLGvynHi8lnR/X976EhuoalIW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619012050; 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=s3oVEqh/OCQqbjBRdu8YosnNoFoNhu1qeacOWn0UZk8=; b=QAR01J9mOlj5alzFcMXT9QdOPhCdRAXBTDtyIUWWZNMwBV3mJCyoA6fT3xy0nlBBAQ18+xBxRCykRkm+ZmLQ9kvjTbBlTnwoxy4F2FbmxVorpoXp6jSRoyAHx00x7u5YdLTazFwJVYOXYbpsA8W1zampJE92WoPT+4Hst3m3H9w= 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 1619012050573365.10650020953847; Wed, 21 Apr 2021 06:34:10 -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-121-hyrbxrlkMp-B99xmo7KpkQ-1; Wed, 21 Apr 2021 09:34:05 -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 7CF5A107ACE8; Wed, 21 Apr 2021 13:33: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 6051439A65; Wed, 21 Apr 2021 13:33: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 28B171806D1D; Wed, 21 Apr 2021 13:33:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LDXnd6019841 for ; Wed, 21 Apr 2021 09:33:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id AC573629C0; Wed, 21 Apr 2021 13:33:49 +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 F37BF669ED; Wed, 21 Apr 2021 13:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619012049; 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=s3oVEqh/OCQqbjBRdu8YosnNoFoNhu1qeacOWn0UZk8=; b=CyhwlfBbvd+XHZNefU/yhR6A6khYrug7WLTTys58mclxbSSv3tb/uem2iJ6te1ukFZnhTT C9XlhmjFIvOG7k3892suKsS2W/ZNyq/sT0UfBX6vthlkogoV2V1tPUGVbehkCvpAT4aPrV oudd21imwODGN7/8ZA/UabSs5oCP2Fg= X-MC-Unique: hyrbxrlkMp-B99xmo7KpkQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] virDomainLoaderDefParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 15:33:32 +0200 Message-Id: <20210421133332.59662-11-twiederh@redhat.com> In-Reply-To: <20210421133332.59662-1-twiederh@redhat.com> References: <20210421133332.59662-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: Peter Krempa --- src/conf/domain_conf.c | 47 ++++++++++-------------------------------- 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1878d9ed9d..4c88a124bc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18837,15 +18837,16 @@ virDomainLoaderDefParseXML(xmlNodePtr node, virDomainLoaderDef *loader, bool fwAutoSelect) { - g_autofree char *readonly_str =3D NULL; - g_autofree char *secure_str =3D NULL; - g_autofree char *type_str =3D NULL; + if (!fwAutoSelect) { + if (virXMLPropTristateBool(node, "readonly", VIR_XML_PROP_NONE, + &loader->readonly) < 0) + return -1; =20 - secure_str =3D virXMLPropString(node, "secure"); + if (virXMLPropEnum(node, "type", virDomainLoaderTypeFromString, + VIR_XML_PROP_NONE | VIR_XML_PROP_NONZERO, + &loader->type) < 0) + return -1; =20 - if (!fwAutoSelect) { - readonly_str =3D virXMLPropString(node, "readonly"); - type_str =3D virXMLPropString(node, "type"); if (!(loader->path =3D virXMLNodeContentString(node))) return -1; =20 @@ -18853,35 +18854,9 @@ virDomainLoaderDefParseXML(xmlNodePtr node, VIR_FREE(loader->path); } =20 - if (readonly_str) { - int value; - if ((value =3D virTristateBoolTypeFromString(readonly_str)) <=3D 0= ) { - virReportError(VIR_ERR_XML_DETAIL, - _("unknown readonly value: %s"), readonly_str); - return -1; - } - loader->readonly =3D value; - } - - if (secure_str) { - int value; - if ((value =3D virTristateBoolTypeFromString(secure_str)) <=3D 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("unknown secure value: %s"), secure_str); - return -1; - } - loader->secure =3D value; - } - - if (type_str) { - int type; - if ((type =3D virDomainLoaderTypeFromString(type_str)) <=3D 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("unknown type value: %s"), type_str); - return -1; - } - loader->type =3D type; - } + if (virXMLPropTristateBool(node, "secure", VIR_XML_PROP_NONE, + &loader->secure) < 0) + return -1; =20 return 0; } --=20 2.26.3