From nobody Sun May 19 10:01:19 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=1619020318; cv=none; d=zohomail.com; s=zohoarc; b=YnHajRYeVxkE20USGvf/9v3PF4xCvPhIFlBeqRIo1PCFHP57sXHavtMhhMLql7t5HnxR1BwenZ0MY6vvgsKOPRAvBIPI/fGEOJgvNwz4baD0GIJzQED7KS7JgHbDDhEwAObDWO7XPu60MHZKafQZcMr0y5QoR8LsHuJe2iPIslg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020318; 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=X2WpyGmjBepbwHHjGYIAqDVrkaD/t/ggXFxL7eAfyz0=; b=TuqElmoJC82TnvYxVDjoFAXlbfQKh/Uoz8LNaOUn0ex7kx4wMWzomS+zTW5/bZpuZgOG9zKECKNPUpApQjdLrgDunjq478RnomjVOTzdnDBqWOwTSxNIS5Wcudab/imkbq/OIyrd+Dfal6GkHUmBy3xHbFgw5YWo/ZDh/Zw8vjo= 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 1619020318742379.3352934950774; Wed, 21 Apr 2021 08:51: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-67-0Xwzc5MROeKqyPTj_c7MtQ-1; Wed, 21 Apr 2021 11:51:54 -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 73A5183DD2C; Wed, 21 Apr 2021 15:51: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 5B19B1B5F7; Wed, 21 Apr 2021 15:51:44 +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 88D1E44A58; Wed, 21 Apr 2021 15:51:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LFpeHF006863 for ; Wed, 21 Apr 2021 11:51:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83CD110016DB; Wed, 21 Apr 2021 15:51: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 C93EA1007610; Wed, 21 Apr 2021 15:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020317; 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=X2WpyGmjBepbwHHjGYIAqDVrkaD/t/ggXFxL7eAfyz0=; b=O330FR5oPYIs2NyTpMkzR61jEH8Ns4wY14ma6+bC7oYyOus3DTXfgLwLwPSEpgBNUlfldf ax9E6XTQIfrobU89X3en43B2CnJYfLBrLoka+3te814qNLqYxhNTrLoUsUpeiGZnCWWb2D 2bxYAqhcRvWGOXfjDborr11P/CP1yps= X-MC-Unique: 0Xwzc5MROeKqyPTj_c7MtQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] virDomainKeyWrapCipherDefParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 17:51:24 +0200 Message-Id: <20210421155133.162030-2-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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: Michal Privoznik --- src/conf/domain_conf.c | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0a00be4e80..cc0bdeed56 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1449,46 +1449,28 @@ static int virDomainKeyWrapCipherDefParseXML(virDomainKeyWrapDef *keywrap, xmlNodePtr node) { - int state_type; - int name_type; - g_autofree char *name =3D NULL; - g_autofree char *state =3D NULL; - - if (!(name =3D virXMLPropString(node, "name"))) { - virReportError(VIR_ERR_CONF_SYNTAX, "%s", - _("missing name for cipher")); - return -1; - } + virDomainKeyWrapCipherName name; + virTristateSwitch state; =20 - if ((name_type =3D virDomainKeyWrapCipherNameTypeFromString(name)) < 0= ) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("%s is not a supported cipher name"), name); + if (virXMLPropEnum(node, "name", virDomainKeyWrapCipherNameTypeFromStr= ing, + VIR_XML_PROP_REQUIRED, &name) < 0) return -1; - } =20 - if (!(state =3D virXMLPropString(node, "state"))) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("missing state for cipher named %s"), name); + if (virXMLPropTristateSwitch(node, "state", VIR_XML_PROP_REQUIRED, + &state) < 0) return -1; - } - - if ((state_type =3D virTristateSwitchTypeFromString(state)) < 0) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("%s is not a supported cipher state"), state); - return -1; - } =20 - switch ((virDomainKeyWrapCipherName) name_type) { + switch (name) { case VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_AES: if (keywrap->aes !=3D VIR_TRISTATE_SWITCH_ABSENT) { virReportError(VIR_ERR_INTERNAL_ERROR, _("A domain definition can have no more than " "one cipher node with name %s"), - virDomainKeyWrapCipherNameTypeToString(name_typ= e)); + virDomainKeyWrapCipherNameTypeToString(name)); =20 return -1; } - keywrap->aes =3D state_type; + keywrap->aes =3D state; break; =20 case VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_DEA: @@ -1496,11 +1478,11 @@ virDomainKeyWrapCipherDefParseXML(virDomainKeyWrapD= ef *keywrap, virReportError(VIR_ERR_INTERNAL_ERROR, _("A domain definition can have no more than " "one cipher node with name %s"), - virDomainKeyWrapCipherNameTypeToString(name_typ= e)); + virDomainKeyWrapCipherNameTypeToString(name)); =20 return -1; } - keywrap->dea =3D state_type; + keywrap->dea =3D state; break; =20 case VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_LAST: --=20 2.26.3 From nobody Sun May 19 10:01:19 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=1619020313; cv=none; d=zohomail.com; s=zohoarc; b=Qoi0/sXvXzem8x+YbPygGLsE32z5q4wV+2Bv9MoYvYb1G0FFIbJ25Roxe/jIMocpdE7SwBKuCnvkXdEdtu79TKRyElYsvIhuou21X1ev1NpUQTExXnxPOvMXEeHOBfK4KFqsVvyA7UNSYP/nxG3mH5ce8jazptN3Qy844po9F8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020313; 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=pgdg5B7ZIoJplPX1UVcvNQCCty8GnntJqVFu+rn3+8Q=; b=eY/HfhpUnEjfg4cUvak28nQwWrWk2SO6ixi86/GSBcPKWxykL4ypK7iSNkt+lWe2FA4ssi9vP1IaI7N69yW02SbWBFeGGYNDWpITwQEO9XmqWHtAI8DMtZZUAhwtPMq9/kUxibUOgpiK9XftY+Uet4JC0GdofG4RDIdM1lBmON0= 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 1619020313313148.25762399805058; Wed, 21 Apr 2021 08:51: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-242-ZcXnrR4-O8-9FoWRz_ERpw-1; Wed, 21 Apr 2021 11:51:50 -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 9B6D68030DD; Wed, 21 Apr 2021 15:51:44 +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 63CA810016DB; Wed, 21 Apr 2021 15:51:44 +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 A39E844A5B; Wed, 21 Apr 2021 15:51:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LFpf69006873 for ; Wed, 21 Apr 2021 11:51:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9370F1007610; Wed, 21 Apr 2021 15:51:41 +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 D6D5E10016DB; Wed, 21 Apr 2021 15:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020312; 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=pgdg5B7ZIoJplPX1UVcvNQCCty8GnntJqVFu+rn3+8Q=; b=DDdLxE3Y9xUWRiNy2PZJ2IiDLjsnMmvMz8mQyeBVso8GssAQvjKgdf/icipXjz0Y+bjG9+ y4Twl+8T9586vnyA6kgEk+ggVkRLJA+si2qDKEUkLtBjv5PZVcKtw+GWQhsESTcKny2t3J ui/cs2Atu9ukTQmp7ITbJvsYzbsdBLo= X-MC-Unique: ZcXnrR4-O8-9FoWRz_ERpw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] virDomainKeyWrapDef: Make members virTristateSwitch Date: Wed, 21 Apr 2021 17:51:25 +0200 Message-Id: <20210421155133.162030-3-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.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" With the last usage of `aes` and `dea` as int gone, these two can become virTristateSwitch. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/conf/domain_conf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4d1826362f..8e55d6e25f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2615,8 +2615,8 @@ struct _virDomainPerfDef { }; =20 struct _virDomainKeyWrapDef { - int aes; /* enum virTristateSwitch */ - int dea; /* enum virTristateSwitch */ + virTristateSwitch aes; + virTristateSwitch dea; }; =20 typedef enum { --=20 2.26.3 From nobody Sun May 19 10:01:19 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=1619020325; cv=none; d=zohomail.com; s=zohoarc; b=kw6Y5d8IwWXgcgE5un24pAVae00aw1l08xY0NdoQ5KFDhwkTAnagvMGiZnX67xsOTVvbxtvbsTxZOj27+N4H9Vwr6yoMUPXJgVm5akteP1Cq10Ojft5XPQwLU8AOio+jgKPEISfDXfDQIf6TXX8p+vXZT0O4PSUYab3yLcfOcMY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020325; 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=Y9ow6U8yDxDsfmXRVu4ReSrXbKoEzUKh4TKCBf3cSho=; b=X1BmxaR0Hfyq+RWqvNQxu7y6Z3FiSHi7n3GQVDsr+eamsSEuutdzWitPL0yhzrGJ9BoE27oCwdR2Z5fxcEiw6+cXc2bEI90nxzj0QYYAk5rn3ZLjKuJsdlEKvBxleMVjd+8QJ4FQX0X5AR2OIVwS9syqIRaSRnfGdehK/hb80HM= 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 1619020325255511.01976516090235; Wed, 21 Apr 2021 08:52: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-457-eTaGNsDYMI6T6IfevDbfSQ-1; Wed, 21 Apr 2021 11:52:01 -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 0F52A1020C2A; Wed, 21 Apr 2021 15:51:51 +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 DF1155D6A1; Wed, 21 Apr 2021 15:51:50 +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 A4E5A44A62; Wed, 21 Apr 2021 15:51:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LFpgBn006881 for ; Wed, 21 Apr 2021 11:51:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id A91F210016DB; Wed, 21 Apr 2021 15:51:42 +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 EBF941007610; Wed, 21 Apr 2021 15:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020324; 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=Y9ow6U8yDxDsfmXRVu4ReSrXbKoEzUKh4TKCBf3cSho=; b=fOnEQkBGCUB112i0+B+FjWdzs7zqqKmv3rLWM6NimhhN3koGQezKDMU5dgBuC2lmAXLbF8 EtLlufh1uGpi2+9pXFEBrwyZW395aVKaafGXffs9BZi6UzVrTHz6JMkI+cGt/pbgS7ZDkG JWYZzKyqNPwL9wK6kLPOuBCgZQR2QWM= X-MC-Unique: eTaGNsDYMI6T6IfevDbfSQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] qemuAppendKeyWrapMachineParm: Stricten parameter types Date: Wed, 21 Apr 2021 17:51:26 +0200 Message-Id: <20210421155133.162030-4-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Follow up to the last patch. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2ceff15512..be93182092 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6804,7 +6804,8 @@ qemuBuildCpuCommandLine(virCommand *cmd, =20 static bool qemuAppendKeyWrapMachineParm(virBuffer *buf, virQEMUCaps *qemuCaps, - int flag, const char *pname, int pstate) + virQEMUCapsFlags flag, const char *pname, + virTristateSwitch pstate) { if (pstate !=3D VIR_TRISTATE_SWITCH_ABSENT) { if (!virQEMUCapsGet(qemuCaps, flag)) { --=20 2.26.3 From nobody Sun May 19 10:01:19 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=1619020320; cv=none; d=zohomail.com; s=zohoarc; b=RNvp6Nm9DJgqh47kcvULTsbR3sCfWMnG/a2CrCP1EzTnQPGkVeFldKVUxpP8RJimn8HQjigFfNpbB+pKjXWUSkxdCJeEgZu8pDKiIzihCKLtwU+xYAbm0ImpKmX45SkeM3DoDKvVsq+idbmDLbaDWrggSmXlb6vrNlE3YJA9E0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020320; 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=3epzn8FWn76vj4i8TuuCwCRrUj5HEVTkXulpb5qbnyg=; b=KnWTt2YWUFyApb7lQ2SGPF0/U6v+UUrmR22Ja9pelV+3LbsXpd732xemtWaQh4rVaOMN+I0blOAUf9IkDh39IZWlwHDrgG78xV6tHXCmF8hJbMNjyLZUXKjTX/nS/K8ij9UkDKQNtyuKZ8gYLYt0ASsrX1Qvb36L7Vmyf7RYvVY= 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 1619020320420537.2352357973331; Wed, 21 Apr 2021 08:52:00 -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-123-14eHwNtHNrO1aw-JZmU-wA-1; Wed, 21 Apr 2021 11:51:57 -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 00356343A4; Wed, 21 Apr 2021 15:51:51 +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 CA1171972B; Wed, 21 Apr 2021 15:51:50 +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 94C7F1806D1D; Wed, 21 Apr 2021 15:51:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LFphkJ006898 for ; Wed, 21 Apr 2021 11:51:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id BC0B4100AE2C; Wed, 21 Apr 2021 15:51:43 +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 08CF110016DB; Wed, 21 Apr 2021 15:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020319; 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=3epzn8FWn76vj4i8TuuCwCRrUj5HEVTkXulpb5qbnyg=; b=BAnHOte6Z60hy6UCqfuJYCT02q5WzV+YP0PR2ONnfYsTolzN0a/6BXqFbGH4mVDKV/twZO fdRZwf5v3ZCqxEEbgQ1Cedk2g735+uQ5KaHLodz7gfmqz37+5dEnKpIJtXuamsViFFQ++B bocqwCJEP1wMHy0hQDMvw8MEHx0VElI= X-MC-Unique: 14eHwNtHNrO1aw-JZmU-wA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] virxml: Add virXMLPropULongLong Date: Wed, 21 Apr 2021 17:51:27 +0200 Message-Id: <20210421155133.162030-5-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.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" Convenience function to return the value of an unsigned long long XML attribute. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/libvirt_private.syms | 1 + src/util/virxml.c | 56 ++++++++++++++++++++++++++++++++++++++++ src/util/virxml.h | 8 ++++++ 3 files changed, 65 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index abd3dc4bd1..0e6bf3d5b3 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3554,6 +3554,7 @@ virXMLPropStringLimit; virXMLPropTristateBool; virXMLPropTristateSwitch; virXMLPropUInt; +virXMLPropULongLong; virXMLSaveFile; virXMLValidateAgainstSchema; virXMLValidatorFree; diff --git a/src/util/virxml.c b/src/util/virxml.c index 5ceef73814..b79050db35 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -755,6 +755,62 @@ virXMLPropUInt(xmlNodePtr node, } =20 =20 +/** + * virXMLPropULongLong: + * @node: XML dom node pointer + * @name: Name of the property (attribute) to get + * @base: Number base, see strtol + * @flags: Bitwise or of virXMLPropFlags + * @result: The returned value + * + * Convenience function to return value of an unsigned long long attribute. + * + * Returns 1 in case of success in which case @result is set, + * or 0 if the attribute is not present, + * or -1 and reports an error on failure. + */ +int +virXMLPropULongLong(xmlNodePtr node, + const char* name, + int base, + virXMLPropFlags flags, + unsigned long long *result) +{ + g_autofree char *tmp =3D NULL; + int ret; + unsigned long long val; + + if (!(tmp =3D virXMLPropString(node, name))) { + if (!(flags & VIR_XML_PROP_REQUIRED)) + return 0; + + virReportError(VIR_ERR_XML_ERROR, + _("Missing required attribute '%s' in element '%s'"= ), + name, node->name); + return -1; + } + + ret =3D virStrToLong_ullp(tmp, NULL, base, &val); + + if (ret < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid value for attribute '%s' in element '%s'= : '%s'. Expected integer value"), + name, node->name, tmp); + return -1; + } + + if ((flags & VIR_XML_PROP_NONZERO) && (val =3D=3D 0)) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid value for attribute '%s' in element '%s'= : Zero is not permitted"), + name, node->name); + return -1; + } + + *result =3D val; + return 1; +} + + /** * virXMLPropEnum: * @node: XML dom node pointer diff --git a/src/util/virxml.h b/src/util/virxml.h index c83d16a14a..13c543fbb6 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -134,6 +134,14 @@ virXMLPropUInt(xmlNodePtr node, unsigned int *result) ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); =20 +int +virXMLPropULongLong(xmlNodePtr node, + const char* name, + int base, + virXMLPropFlags flags, + unsigned long long *result) + ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); + int virXMLPropEnum(xmlNodePtr node, const char* name, --=20 2.26.3 From nobody Sun May 19 10:01:19 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=1619020390; cv=none; d=zohomail.com; s=zohoarc; b=RP6sJoYruf88oDS6+p0TKn0l2oHwDd4zj1I8MPfMze1Vm1zKyvDJbtF0kq8Jk9kvIm/b4IZvIiVE1B6LCdR+/fo2DHsssH2L0TGMxCoyIjLfsbzz5XHdCRqBlP4GlS56Al8TtOYpBJ0nHWAeSzpaUfPWGuyZtVhe3LCvBV4htMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020390; 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=KKZ4Kj8N7+rp5vhaGke2JB2vNwxXdQI5YicB4hcHvsU=; b=MPLWAHbU5YAxdTXpeKQBTW4ZnCx8sXSoCOq0JOQ7R8KAdG9dmfQXgNK7ghzdN0gM3OaCbl/byT/YX8zUtg64bNvzasDCYqbGDRg3nRwahCDL/gXQJPSXpEFdsHI/hwPKIc91+Et43DBkJ8AfW+ph5iVeaH03Eszt+NUryqCUNVs= 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 1619020390512343.62403420523935; Wed, 21 Apr 2021 08:53: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-502-PwVBxEjINa-N4Vgoc-Tltw-1; Wed, 21 Apr 2021 11:52: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 30AA183DD31; Wed, 21 Apr 2021 15:51:53 +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 100A76064B; Wed, 21 Apr 2021 15:51:53 +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 C87C91806D1E; Wed, 21 Apr 2021 15:51:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LFpi4j006905 for ; Wed, 21 Apr 2021 11:51:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id C3E221017CF5; Wed, 21 Apr 2021 15:51: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 190C6100AE2C; Wed, 21 Apr 2021 15:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020389; 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=KKZ4Kj8N7+rp5vhaGke2JB2vNwxXdQI5YicB4hcHvsU=; b=OXs67f3KJMzJcMU506t6TIflZ5X3rD7fnxYdLeIAMrb0aDbU3hGoCk91sjvAuw7odXtoxo JkWaC5VjehwwWAMkDlOa0E7L9VaDdmwOJ7ztJMNpQrfP7IXQYO2fF9Sdm9tag1+70VGSWn Y1YmbDsgIUNfiNReB2u6Lkki92vxl2A= X-MC-Unique: PwVBxEjINa-N4Vgoc-Tltw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] virDomainDeviceDimmAddressParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 17:51:28 +0200 Message-Id: <20210421155133.162030-6-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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: Michal Privoznik --- src/conf/domain_conf.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cc0bdeed56..c1ed206119 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6508,24 +6508,13 @@ static int virDomainDeviceDimmAddressParseXML(xmlNodePtr node, virDomainDeviceDimmAddress *addr) { - g_autofree char *tmp =3D NULL; - - if (!(tmp =3D virXMLPropString(node, "slot")) || - virStrToLong_uip(tmp, NULL, 10, &addr->slot) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid or missing dimm slot id '%s'"), - NULLSTR(tmp)); + if (virXMLPropUInt(node, "slot", 10, VIR_XML_PROP_REQUIRED, + &addr->slot) < 0) return -1; - } - VIR_FREE(tmp); =20 - if ((tmp =3D virXMLPropString(node, "base"))) { - if (virStrToLong_ullp(tmp, NULL, 16, &addr->base) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid dimm base address '%s'"), tmp); - return -1; - } - } + if (virXMLPropULongLong(node, "base", 16, VIR_XML_PROP_NONE, + &addr->base) < 0) + return -1; =20 return 0; } --=20 2.26.3 From nobody Sun May 19 10:01:19 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=1619020393; cv=none; d=zohomail.com; s=zohoarc; b=W5/SFcIGoU/ed5YlBjznrD0ZsJ9cDOsDX8i8uP9MQmNtiIx7h+Addec9D+jWvE6ewOhkPm2fg8UWIQC8jcU6KNzjiFcIEpoa2ppdLKzgMoIa17cAeCqqatInsk3ibur6L+6NH5SYos2WmiiFgr3eqvRJaT7FiKRkhWZsYjCsr74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020393; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S6L/ubH4DlDwYiSIgsyqMR2GaZyQMi4jwZSQpNRv0YE=; b=OMeV1DJoHGBk/7zsIKGeam5tlTwnDaNp17aDRr2SFi2MgbJ9iG3hInS1EmSDzNval4xSjD/5soXSQna5qn3xBGkVMZuee/fc/rVEof+EQlInRfhrt+p+kOlhkdr202VM0ZQu4dOzArHjA8ywr8isuMmTFyDnS5J3Y08QhB5xPw0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 161902039336487.45476681016123; Wed, 21 Apr 2021 08:53:13 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-390-PBmzzAAdNhe7SvudeP2fSw-1; Wed, 21 Apr 2021 11:52:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03F14188D6A1; Wed, 21 Apr 2021 15:51:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A91495D747; Wed, 21 Apr 2021 15:51:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 75A3F1806D23; Wed, 21 Apr 2021 15:51:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LFpjEn006912 for ; Wed, 21 Apr 2021 11:51:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id D398710016DB; Wed, 21 Apr 2021 15:51:45 +0000 (UTC) Received: from work.redhat.com (ovpn-112-172.ams2.redhat.com [10.36.112.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 248C11007610; Wed, 21 Apr 2021 15:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020392; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=S6L/ubH4DlDwYiSIgsyqMR2GaZyQMi4jwZSQpNRv0YE=; b=I3GP89ODxWEQojonhRzaaO8msAZ733ZOuOKS3yvS3/UaAAZcrVWq2HUAgSSLw9sTSbqcMx nqlMmnMIVl/P+q2U975Nn8Vy1CAZCBL8OmfvNTw2Z3bTGNQe80ectSnHgn/WNPZuK/m78/ cDb90s055O6nnxoTAq/B67cevmlHm1E= X-MC-Unique: PBmzzAAdNhe7SvudeP2fSw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] virDomainHostdevSubsysSCSIHostDefParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 17:51:29 +0200 Message-Id: <20210421155133.162030-7-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c1ed206119..eaa1398de1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7027,9 +7027,6 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr = sourcenode, virDomainXMLOption *xmlopt) { virDomainHostdevSubsysSCSIHost *scsihostsrc =3D &scsisrc->u.host; - g_autofree char *bus =3D NULL; - g_autofree char *target =3D NULL; - g_autofree char *unit =3D NULL; xmlNodePtr addressnode =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 @@ -7041,32 +7038,17 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePt= r sourcenode, return -1; } =20 - if (!(bus =3D virXMLPropString(addressnode, "bus")) || - !(target =3D virXMLPropString(addressnode, "target")) || - !(unit =3D virXMLPropString(addressnode, "unit"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("'bus', 'target', and 'unit' must be specified " - "for scsi hostdev source address")); - return -1; - } - - if (virStrToLong_uip(bus, NULL, 0, &scsihostsrc->bus) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse bus '%s'"), bus); + if (virXMLPropUInt(addressnode, "bus", 0, VIR_XML_PROP_REQUIRED, + &scsihostsrc->bus) < 0) return -1; - } =20 - if (virStrToLong_uip(target, NULL, 0, &scsihostsrc->target) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse target '%s'"), target); + if (virXMLPropUInt(addressnode, "target", 0, VIR_XML_PROP_REQUIRED, + &scsihostsrc->target) < 0) return -1; - } =20 - if (virStrToLong_ullp(unit, NULL, 0, &scsihostsrc->unit) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse unit '%s'"), unit); + if (virXMLPropULongLong(addressnode, "unit", 0, VIR_XML_PROP_REQUIRED, + &scsihostsrc->unit) < 0) return -1; - } =20 if (!(scsihostsrc->adapter =3D virXPathString("string(./adapter/@name)= ", ctxt))) { virReportError(VIR_ERR_XML_ERROR, "%s", --=20 2.26.3 From nobody Sun May 19 10:01:19 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=1619020357; cv=none; d=zohomail.com; s=zohoarc; b=SNHtppx7r3yLGulk3M1S1oXZbuCN7ejmFarkockVJBPhQ+JrqM1PRAAP9KclibRaNYAjSCaX+artsR+DmQS0DaMv2emosh+s7ByLIwGVdQggdD6lMeWSLIARhWXBpMPmJ/L+ypgXxqh4o78Ju4tmQbHNt3JEAYKexyBIseplE24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020357; 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=zMwnjmoNGHab4W1xhAK5i8G305PFWoP/+2RKB82HRCg=; b=dZZSJH+xDJEJ3f1g5KJ33eWGPhN55sKD/Q8fVW76dkEVp2lVnq9BJ3GdaJKdP0M7US8bKfwkLROx1hgY6wPZnIzrqQYBbNfo8gFRrrQ4tQ7DVSlxkCl6FqyXQA3wdjfU8YiiTnspfYjInIU0jdoN35/1g/ZgkwMEHuVRCc1Q6TI= 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 1619020357140206.63269422543044; Wed, 21 Apr 2021 08:52:37 -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-532-NjQmjBWNMam_GJY-4n3exA-1; Wed, 21 Apr 2021 11:51:58 -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 878EF107ACF9; Wed, 21 Apr 2021 15:51:53 +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 6A1E859448; Wed, 21 Apr 2021 15:51:53 +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 34A3B180B651; Wed, 21 Apr 2021 15:51:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LFpkNM006921 for ; Wed, 21 Apr 2021 11:51:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id DEF521017CF5; Wed, 21 Apr 2021 15:51: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 3196610016DB; Wed, 21 Apr 2021 15:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020356; 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=zMwnjmoNGHab4W1xhAK5i8G305PFWoP/+2RKB82HRCg=; b=iggzLV+dTHykcHORsSAvENuIeY2lov5M2rzZUyTMcoRaYBMuQLjOZ9b/yKL0GRl7p6Vgar h6MeYoCaRx9TL1MmnLrcCQTZ53modXbtMBySGz2DnRh3rSrF+zd4FGrGD1xoYwz3iJoDLk xXc6W80pOpl1qiJktjEHs1T9BKjk+Mo= X-MC-Unique: NjQmjBWNMam_GJY-4n3exA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] virStorageEncryptionInfoParseCipher: Use virXMLProp* Date: Wed, 21 Apr 2021 17:51:30 +0200 Message-Id: <20210421155133.162030-8-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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: Michal Privoznik --- src/conf/storage_encryption_conf.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encrypti= on_conf.c index c2c7c1dd43..9112b96cc7 100644 --- a/src/conf/storage_encryption_conf.c +++ b/src/conf/storage_encryption_conf.c @@ -176,27 +176,15 @@ static int virStorageEncryptionInfoParseCipher(xmlNodePtr info_node, virStorageEncryptionInfoDef *info) { - g_autofree char *size_str =3D NULL; - if (!(info->cipher_name =3D virXMLPropString(info_node, "name"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("cipher info missing 'name' attribute")); return -1; } =20 - if ((size_str =3D virXMLPropString(info_node, "size")) && - virStrToLong_uip(size_str, NULL, 10, &info->cipher_size) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("cannot parse cipher size: '%s'"), - size_str); - return -1; - } - - if (!size_str) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("cipher info missing 'size' attribute")); + if (virXMLPropUInt(info_node, "size", 10, VIR_XML_PROP_REQUIRED, + &info->cipher_size) < 0) return -1; - } =20 info->cipher_mode =3D virXMLPropString(info_node, "mode"); info->cipher_hash =3D virXMLPropString(info_node, "hash"); --=20 2.26.3 From nobody Sun May 19 10:01:19 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=1619020341; cv=none; d=zohomail.com; s=zohoarc; b=Mgf/8eKWxSJJJVy73qA56OAxN9M28PJ+DmXFkE32/fZmhT1EBqY30U9P7AWN9GKrbHPO7ieO1uIubjNQKnxldbQ/dbrKCFZaTx0OTw6bHdh1e2+Atso2dkadhcnceU2m2wwHlWFZbm7YiT45G7Nrjbn1fieSoII0xH2/m7QDZBA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020341; 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=X4N3ko5mLtDjxuExbSSpX8dcOM6oUjQrQgoEh9hrGRE=; b=kblsmjeuQEoBtwoprF5VvGqsYscDELI5b+HHiEcZAzIw1U7FDgpuAv/n3ILqIS4W5VS76dJ5C4nxk3p5aD1OsCu/hPsC8QJFMKgx2oRhddJY60NWrJXwrxeIUIJuTKcPOGb5rlE2kZvs7ex8N+sK3ScX1qP2LH1yToju/QgKG9I= 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 1619020341469939.4281069813519; Wed, 21 Apr 2021 08:52:21 -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-161-I8Z4ZgQEMwuw-q3QISpQOA-1; Wed, 21 Apr 2021 11:52:08 -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 9999B805725; Wed, 21 Apr 2021 15:51:58 +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 76E40610A8; Wed, 21 Apr 2021 15:51: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 416FD8E1F; Wed, 21 Apr 2021 15:51:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LFplN0006932 for ; Wed, 21 Apr 2021 11:51:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id EA8C81017CF5; Wed, 21 Apr 2021 15:51: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 3F09610016DB; Wed, 21 Apr 2021 15:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020340; 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=X4N3ko5mLtDjxuExbSSpX8dcOM6oUjQrQgoEh9hrGRE=; b=V+eJ11hyFANlf/3EZTOA0cXHxFZwbMdF/Mv1HMb+Mlfv9+nkZjCvca2OXpMWVmEjNJDmVp jQIhLaxB65hauojPHORDP0Bal3y1S1km7cbnog0EwQNynsc0ofdqAOCPRQEUjUrRyjBOhb /Yp3wgDAgpYxZyh41Qix6ULeNCOeF5E= X-MC-Unique: I8Z4ZgQEMwuw-q3QISpQOA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] virDomainDeviceInfoParseXML: Use virXMLProp* Date: Wed, 21 Apr 2021 17:51:31 +0200 Message-Id: <20210421155133.162030-9-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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: Michal Privoznik --- src/conf/domain_conf.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index eaa1398de1..367258bf7a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6622,15 +6622,13 @@ virDomainDeviceInfoParseXML(virDomainXMLOption *xml= opt, virDomainDeviceInfo *info, unsigned int flags) { + xmlNodePtr acpi =3D NULL; xmlNodePtr address =3D NULL; xmlNodePtr master =3D NULL; xmlNodePtr boot =3D NULL; xmlNodePtr rom =3D NULL; int ret =3D -1; - g_autofree char *romenabled =3D NULL; - g_autofree char *rombar =3D NULL; g_autofree char *aliasStr =3D NULL; - g_autofree char *acpiIndex =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 virDomainDeviceInfoClear(info); @@ -6657,24 +6655,14 @@ virDomainDeviceInfoParseXML(virDomainXMLOption *xml= opt, =20 if ((flags & VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) && (rom =3D virXPathNode("./rom", ctxt))) { - if ((romenabled =3D virXPathString("string(./rom/@enabled)", ctxt)= )) { - int value; - if ((value =3D virTristateBoolTypeFromString(romenabled)) <=3D= 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown rom enabled value '%s'"), romena= bled); - goto cleanup; - } - info->romenabled =3D value; - } - if ((rombar =3D virXPathString("string(./rom/@bar)", ctxt))) { - int value; - if ((value =3D virTristateSwitchTypeFromString(rombar)) <=3D 0= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown rom bar value '%s'"), rombar); - goto cleanup; - } - info->rombar =3D value; - } + if (virXMLPropTristateBool(rom, "enabled", VIR_XML_PROP_NONE, + &info->romenabled) < 0) + goto cleanup; + + if (virXMLPropTristateSwitch(rom, "bar", VIR_XML_PROP_NONE, + &info->rombar) < 0) + goto cleanup; + info->romfile =3D virXMLPropString(rom, "file"); =20 if (info->romenabled =3D=3D VIR_TRISTATE_BOOL_NO && @@ -6685,12 +6673,10 @@ virDomainDeviceInfoParseXML(virDomainXMLOption *xml= opt, } } =20 - acpiIndex =3D virXPathString("string(./acpi/@index)", ctxt); - if (acpiIndex && - virStrToLong_ui(acpiIndex, NULL, 10, &info->acpiIndex) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Cannot parse ACPI index value '%s'"), acpiIndex); - goto cleanup; + if ((acpi =3D virXPathNode("./acpi", ctxt))) { + if (virXMLPropUInt(acpi, "index", 10, VIR_XML_PROP_NONE, + &info->acpiIndex) < 0) + goto cleanup; } =20 if ((address =3D virXPathNode("./address", ctxt)) && --=20 2.26.3 From nobody Sun May 19 10:01:19 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=1619020397; cv=none; d=zohomail.com; s=zohoarc; b=lQnxrHkkq+IZtxNb9p/zv9wgSxladbtSa9c7rJLuMmGhcjxuYrEQvPZqsKp0S4VAQdLLwzAhjO8CN5b/L1RqUltCAjSqrR/XMk5b1bBRs0KwOv9Wmw61smB50CWzbbQNKupM7hd8+fKljoIX+n0hGSc4QuHmVqs+ONpe5p4at88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020397; 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=kCLL2qPcO6P2kpA12WDOsDrEmPKpcoS2b9cCsfip1u0=; b=aCOaa9Eel96VtB1jU/WIVlI1+s9DVGKnfGtcYq4nHvH9sOiC/FDCwj2WDbzwrFgya73KK9PSCvIvwu0H5eyVmGsaiCQTcwhLDcuNdf4MkKyw4eZOd81lUSj3pFfI6TTpn0AX4188E1vo3HmEF8ifouTHJKzrUJDewaHgYS3m0yg= 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 1619020397613754.1254478313491; Wed, 21 Apr 2021 08:53:17 -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-470-Kh1exgTSP4OCssVpL8zYhA-1; Wed, 21 Apr 2021 11:52:08 -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 AA0EA83DD5A; Wed, 21 Apr 2021 15:52: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 7D91919D80; Wed, 21 Apr 2021 15:52: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 44DBB9964; Wed, 21 Apr 2021 15:52:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LFpncs006948 for ; Wed, 21 Apr 2021 11:51:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 041821017CF5; Wed, 21 Apr 2021 15:51: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 49E0A10016DB; Wed, 21 Apr 2021 15:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020396; 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=kCLL2qPcO6P2kpA12WDOsDrEmPKpcoS2b9cCsfip1u0=; b=JiN1pM1C/ggBaNuT0mLSKCQeP/vsWr+xA3odpLcHCLS66VOlJu7F0IYJf1O+koSqgxi+Oh k4Z9+w08AFOAWYBA8xrlz+dFB1S+by2ObKMCxylZ6+zNsMXe6t93IxBEFNC8mmXafpu7oZ lRX+ahKIG/d3AZK63qdJkIqGSCLtGug= X-MC-Unique: Kh1exgTSP4OCssVpL8zYhA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] virDomainDiskSourceNetworkParse: Use virXMLProp* Date: Wed, 21 Apr 2021 17:51:32 +0200 Message-Id: <20210421155133.162030-10-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.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 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 55 ++++++++++++------------------------------ 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 367258bf7a..113f4123d7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8273,24 +8273,14 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, virStorageSource *src, unsigned int flags) { - int tlsCfgVal; - g_autofree char *protocol =3D NULL; - g_autofree char *haveTLS =3D NULL; - g_autofree char *tlsCfg =3D NULL; - g_autofree char *sslverifystr =3D NULL; + virStorageNetProtocol protocol; xmlNodePtr tmpnode; =20 - if (!(protocol =3D virXMLPropString(node, "protocol"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing network source protocol type")); + if (virXMLPropEnum(node, "protocol", virStorageNetProtocolTypeFromStri= ng, + VIR_XML_PROP_REQUIRED, &protocol) < 0) return -1; - } =20 - if ((src->protocol =3D virStorageNetProtocolTypeFromString(protocol)) = <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown protocol type '%s'"), protocol); - return -1; - } + src->protocol =3D protocol; =20 if (!(src->path =3D virXMLPropString(node, "name")) && src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_NBD) { @@ -8299,26 +8289,16 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, return -1; } =20 - if ((haveTLS =3D virXMLPropString(node, "tls"))) { - int value; - - if ((value =3D virTristateBoolTypeFromString(haveTLS)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("unknown disk source 'tls' setting '%s'"), ha= veTLS); - return -1; - } - src->haveTLS =3D value; - } + if (virXMLPropTristateBool(node, "tls", VIR_XML_PROP_NONE, + &src->haveTLS) < 0) + return -1; =20 - if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) && - (tlsCfg =3D virXMLPropString(node, "tlsFromConfig"))) { - if (virStrToLong_i(tlsCfg, NULL, 10, &tlsCfgVal) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid tlsFromConfig value: %s"), - tlsCfg); + if (flags & VIR_DOMAIN_DEF_PARSE_STATUS) { + int value; + if (virXMLPropInt(node, "tlsFromConfig", 10, VIR_XML_PROP_NONE, + &value) < 0) return -1; - } - src->tlsFromConfig =3D !!tlsCfgVal; + src->tlsFromConfig =3D !!value; } =20 /* for historical reasons we store the volume and image name in one XML @@ -8364,15 +8344,10 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, =20 if ((src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTPS || src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_FTPS) && - (sslverifystr =3D virXPathString("string(./ssl/@verify)", ctxt))) { - int verify; - if ((verify =3D virTristateBoolTypeFromString(sslverifystr)) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid ssl verify mode '%s'"), sslverifystr= ); + (tmpnode =3D virXPathNode("./ssl", ctxt))) { + if (virXMLPropTristateBool(tmpnode, "verify", VIR_XML_PROP_NONE, + &src->sslverify) < 0) return -1; - } - - src->sslverify =3D verify; } =20 if ((src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTP || --=20 2.26.3 From nobody Sun May 19 10:01:19 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=1619020388; cv=none; d=zohomail.com; s=zohoarc; b=A4Fk4qQJNBkIl6IbpGI+pDzc5mwwJ/uii1A82QnKSLy3jyQXI0GnO4tdcA0QnhQLHjgoonSTDIpBH0cUq1P6Fm+Gy9hH7TCAUfwZ3CHV9hnnIpDtY+9kDx4RmgK7dn47DNhLsvN6C0gyxROpaL6bIDAT0C3Vq0Y95AkJj33wSII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619020388; 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=6MPU9Gp9nFG+37rfa2HrYlH44YLOqy2G7y4s2KKzh2k=; b=IFQHY0ip+TRt7n47+uCD9ug4h3B0UVsS5i4miKhwhaNqyMfxFxQOVfp4IgDO9NMxFC8VGzsPhPYrqshrVO+jw0G8dW78eVrboZ3ubrLmAQz1hGe4CrveD+jH2g9Vu8ezDTxcQHKsJgk38F00Xd5BC0aSdbqI1LmT62tLlpQ7Rbw= 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 1619020388953500.6396897164674; Wed, 21 Apr 2021 08:53:08 -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-190-tjWnOakcM_iM2FrREgDh0g-1; Wed, 21 Apr 2021 11:52:05 -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 D4646188D68F; Wed, 21 Apr 2021 15:51:54 +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 B483C5D6A1; Wed, 21 Apr 2021 15:51:54 +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 7561A44A63; Wed, 21 Apr 2021 15:51:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13LFpobC006957 for ; Wed, 21 Apr 2021 11:51:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 12DEA100AE2C; Wed, 21 Apr 2021 15:51:50 +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 5869210016DB; Wed, 21 Apr 2021 15:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619020387; 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=6MPU9Gp9nFG+37rfa2HrYlH44YLOqy2G7y4s2KKzh2k=; b=eaSZXuIzCuIPsdeVMGH+p1/uwwHvS9pIi47EKwC1Dq7SO4wcBs2gcUabGAiOiPUxzg4kIq eI9Hqj1Ml+ySorry+PLQzbJ5HqgsSqpaCjfiWBANs2rjgRMBqGxObygLw6SPU8pytUV2vE JVVuTEsdCBbKauifH6z6yL8650A+2Lc= X-MC-Unique: tjWnOakcM_iM2FrREgDh0g-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] virDomainMemorytuneDefParseMemory: Use virXMLProp* Date: Wed, 21 Apr 2021 17:51:33 +0200 Message-Id: <20210421155133.162030-11-twiederh@redhat.com> In-Reply-To: <20210421155133.162030-1-twiederh@redhat.com> References: <20210421155133.162030-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 113f4123d7..c53ed60bae 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20047,36 +20047,16 @@ virDomainMemorytuneDefParseMemory(xmlXPathContext= Ptr ctxt, VIR_XPATH_NODE_AUTORESTORE(ctxt) unsigned int id; unsigned int bandwidth; - g_autofree char *tmp =3D NULL; =20 ctxt->node =3D node; =20 - tmp =3D virXMLPropString(node, "id"); - if (!tmp) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing memorytune attribute 'id'")); + if (virXMLPropUInt(node, "id", 10, VIR_XML_PROP_REQUIRED, &id) < 0) return -1; - } - if (virStrToLong_uip(tmp, NULL, 10, &id) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid memorytune attribute 'id' value '%s'"), - tmp); - return -1; - } - VIR_FREE(tmp); =20 - tmp =3D virXMLPropString(node, "bandwidth"); - if (!tmp) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing memorytune attribute 'bandwidth'")); + if (virXMLPropUInt(node, "bandwidth", 10, VIR_XML_PROP_REQUIRED, + &bandwidth) < 0) return -1; - } - if (virStrToLong_uip(tmp, NULL, 10, &bandwidth) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid memorytune attribute 'bandwidth' value '= %s'"), - tmp); - return -1; - } + if (virResctrlAllocSetMemoryBandwidth(alloc, id, bandwidth) < 0) return -1; =20 --=20 2.26.3