From nobody Thu Mar 28 15:51:18 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=1619192386; cv=none; d=zohomail.com; s=zohoarc; b=mtDOHA9RZAqttu+QRkKXwPoeFSotnBxCykKNMfZ4fF5EoKSf5Sf+jlehBMi5tUo0RWfhfU3/vLUOtLfqLn5bC0O0tCYjo+vG5ESqW+AC5hAM5Lp1igF9Dxbf0CGZLQqGb0CUvg5mjbUzdHDmQS7bnSbk/m9PDDJneNyfE1Y1mcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619192386; 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=rJNpFTOJh4MHIVGl3GxI9c59iAnRaAdkxXbPp12ZmLE=; b=aDvTyQ4tqoysX/Y1cyJWJXM6rOMxacWYDHRObfQC8JJTih9PmxrID6DMWQjQ39kObY9SMQmBqbPBr4byg3/eXb7NTwFVKC8DZ0yHo7hb1BtPpS4nnLYpIoWNuWK/8yYLnETmRMfInOio82ISMgdmPwGGX75zdrBekt7lV8SLZQU= 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 1619192386659535.5403759673901; Fri, 23 Apr 2021 08:39:46 -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-153-v_2ZE_GLPz24_QBOzRa1RA-1; Fri, 23 Apr 2021 11:39:40 -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 7088D10053EC; Fri, 23 Apr 2021 15:39:34 +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 18E725C238; Fri, 23 Apr 2021 15:39:34 +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 528434EA30; Fri, 23 Apr 2021 15:39:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13NFdUjh004199 for ; Fri, 23 Apr 2021 11:39:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id F404060C5A; Fri, 23 Apr 2021 15:39:29 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AB0660854; Fri, 23 Apr 2021 15:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619192385; 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=rJNpFTOJh4MHIVGl3GxI9c59iAnRaAdkxXbPp12ZmLE=; b=QaXQoUFqJ/brZV0FcIUhJs/m/PwBqO8nZSRFErguhx1xQmBxTO44qNLVDn07355mlxmdb3 e3kY6WE4ltsTRDG7FjZqAC2wM6wqhwtK4c57ZXqgYDDsPEi663ZjyxTKG71mNY2W/ehr4d BlciZatb/9wpjUVLll1SEqGTbV+dL7I= X-MC-Unique: v_2ZE_GLPz24_QBOzRa1RA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] virDomainGraphicsDefParseXMLSDL: Use virXMLProp* Date: Fri, 23 Apr 2021 17:39:14 +0200 Message-Id: <20210423153923.339223-2-twiederh@redhat.com> In-Reply-To: <20210423153923.339223-1-twiederh@redhat.com> References: <20210423153923.339223-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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 | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a72d58f488..5b0e90f234 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12813,42 +12813,23 @@ virDomainGraphicsDefParseXMLSDL(virDomainGraphics= Def *def, xmlXPathContextPtr ctxt) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int enableVal; xmlNodePtr glNode; - g_autofree char *fullscreen =3D virXMLPropString(node, "fullscreen"); - g_autofree char *enable =3D NULL; + virTristateBool fullscreen =3D VIR_TRISTATE_BOOL_NO; =20 ctxt->node =3D node; =20 - if (fullscreen !=3D NULL) { - if (virStringParseYesNo(fullscreen, &def->data.sdl.fullscreen) < 0= ) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown fullscreen value '%s'"), fullscreen); - return -1; - } - } else { - def->data.sdl.fullscreen =3D false; - } + if (virXMLPropTristateBool(node, "fullscreen", VIR_XML_PROP_NONE, + &fullscreen) < 0) + return -1; =20 + def->data.sdl.fullscreen =3D fullscreen =3D=3D VIR_TRISTATE_BOOL_YES; def->data.sdl.xauth =3D virXMLPropString(node, "xauth"); def->data.sdl.display =3D virXMLPropString(node, "display"); =20 - glNode =3D virXPathNode("./gl", ctxt); - if (glNode) { - enable =3D virXMLPropString(glNode, "enable"); - if (!enable) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("sdl gl element missing enable")); + if ((glNode =3D virXPathNode("./gl", ctxt))) { + if (virXMLPropTristateBool(glNode, "enable", VIR_XML_PROP_REQUIRED, + &def->data.sdl.gl) < 0) return -1; - } - - enableVal =3D virTristateBoolTypeFromString(enable); - if (enableVal < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown enable value '%s'"), enable); - return -1; - } - def->data.sdl.gl =3D enableVal; } =20 return 0; --=20 2.26.3 From nobody Thu Mar 28 15:51:18 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=1619192393; cv=none; d=zohomail.com; s=zohoarc; b=ak4NuFcNtPi3Ls74cVmKtia6HxN0qHXJQBuZDxWkdqv5EVaoD0SEE4/d4fOf0qVy7fiGcEt2PX8h1DxdTtWxP3Du18dvG4PC98Z6Oke8JSpkz+htYnQHbiNnLNE3tibok/hhKOsF+d3M0D9iPJtfE5PZuJ2yhRMiWVos5oz7dqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619192393; 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=ZvRaFEdPlGPiAYfZZHN9OXbaWGv8eI1EPPA75Z8lLQo=; b=HRxRmRUQhjDLRJqoyOvFsfzl8Tqc4kylfOLPrUMCKc5MSWNxy+q0z5DSYT1dvCeBuFwt0gTZidzO8AVeZ2zzAETIT3g8aPc2bAAr5VNv0DnoYjn3jCewLDe7EUG2fVqqZF0w5dppTzhk5yV6eCaOyxMD0CtaotT52gmNcmuTpV4= 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 1619192393447556.1793437339242; Fri, 23 Apr 2021 08:39: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-109-qi4ZXNjuNi68kpzHx8E87Q-1; Fri, 23 Apr 2021 11:39:49 -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 19A6D8030CA; Fri, 23 Apr 2021 15:39:43 +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 E7E06295D5; Fri, 23 Apr 2021 15:39: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 AFF7B44A61; Fri, 23 Apr 2021 15:39:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13NFdVih004208 for ; Fri, 23 Apr 2021 11:39:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1D6326090F; Fri, 23 Apr 2021 15:39:31 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56E7F60854; Fri, 23 Apr 2021 15:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619192392; 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=ZvRaFEdPlGPiAYfZZHN9OXbaWGv8eI1EPPA75Z8lLQo=; b=efLdR4AVTKN+0HMIk0OKY+W2Ppu4YvbQwqsSQoLB3Cz7dI/8nBKmopuqsRxsRUZq4vsxt2 N80/URoeNZpQjjPyrjN3U2iTXpksp8fkPUASYnX/0CDzcz/hsg2iTHlobpDdz6cA9ytUrc fSJCoo7ogTVv5Xjc/oL2KMLsv1CxqF8= X-MC-Unique: qi4ZXNjuNi68kpzHx8E87Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] virDomainGraphicsDefParseXMLDesktop: Use virXMLProp* Date: Fri, 23 Apr 2021 17:39:15 +0200 Message-Id: <20210423153923.339223-3-twiederh@redhat.com> In-Reply-To: <20210423153923.339223-1-twiederh@redhat.com> References: <20210423153923.339223-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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, 5 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5b0e90f234..d57450b3c0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12885,18 +12885,13 @@ static int virDomainGraphicsDefParseXMLDesktop(virDomainGraphicsDef *def, xmlNodePtr node) { - g_autofree char *fullscreen =3D virXMLPropString(node, "fullscreen"); + virTristateBool fullscreen =3D VIR_TRISTATE_BOOL_NO; =20 - if (fullscreen !=3D NULL) { - if (virStringParseYesNo(fullscreen, &def->data.desktop.fullscreen)= < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown fullscreen value '%s'"), fullscreen); - return -1; - } - } else { - def->data.desktop.fullscreen =3D false; - } + if (virXMLPropTristateBool(node, "fullscreen", VIR_XML_PROP_NONE, + &fullscreen) < 0) + return -1; =20 + def->data.desktop.fullscreen =3D fullscreen =3D=3D VIR_TRISTATE_BOOL_Y= ES; def->data.desktop.display =3D virXMLPropString(node, "display"); =20 return 0; --=20 2.26.3 From nobody Thu Mar 28 15:51:18 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=1619192385; cv=none; d=zohomail.com; s=zohoarc; b=BiHwTAGix5Zrp3Xe8Kh8Rm3+DIETxBKpL2c6cG6vDM19CTIXDHlakRxCWoDyoc14FgOD1jLfSj6xTZrqqyiLIGqYwl41T/jG0ldMjA2sZ3R9HQim49OVypCiE9SL6x4WkqMDSYerA43GHUekWnrhN1qqz3fGD96XchktlZlvTRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619192385; 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=tsE3gs8c/yHQPCTNKOVijuM6NAqPbNrWaQg6FDT5+z4=; b=DZeqx7uvGM7t/+MAia5l48nfsqbTju739+B/23OoblsvubMwGxDR++k77Uu00l8t06SEMWgcTxFaFPHSPmwuxPYdDtod77xv3j2l4BaRaoHd9AxKwAsBqrRWGVreT5ZutXipo+xOgCfbZtA+Pk9+IYX1EgyYg4PlulxQE5lktFE= 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 1619192385342718.8759073063115; Fri, 23 Apr 2021 08:39:45 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-Gtc-2QEpNT-lJ9pyr0s8OQ-1; Fri, 23 Apr 2021 11:39:41 -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 1C107343A2; Fri, 23 Apr 2021 15:39:37 +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 E85F05C1BB; Fri, 23 Apr 2021 15:39:36 +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 B343944A58; Fri, 23 Apr 2021 15:39:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13NFdWG8004217 for ; Fri, 23 Apr 2021 11:39:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E10B6090F; Fri, 23 Apr 2021 15:39:32 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7874A60854; Fri, 23 Apr 2021 15:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619192384; 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=tsE3gs8c/yHQPCTNKOVijuM6NAqPbNrWaQg6FDT5+z4=; b=UfIXttQFxUOz6zZQRjN9/oUDF38lvdbpqfdDyFgD4VY/mFBxCaHDDBwKHweTJLEdB6h/R2 y/l3nlYvBIgaGIpT/RPYEyjAOHR3u8CjJsfyvTn732F6iSyCD+mkYYP5eZ8CJspb1LT4Pe uhwfLleiZUNIG7bDjRdjfhLR7n0LBSU= X-MC-Unique: Gtc-2QEpNT-lJ9pyr0s8OQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] virDomainGraphicsDefParseXMLSpice: Use virXMLProp* Date: Fri, 23 Apr 2021 17:39:16 +0200 Message-Id: <20210423153923.339223-4-twiederh@redhat.com> In-Reply-To: <20210423153923.339223-1-twiederh@redhat.com> References: <20210423153923.339223-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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 | 251 ++++++++++------------------------------- 1 file changed, 59 insertions(+), 192 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d57450b3c0..9aba2edf0a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12905,49 +12905,30 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphi= csDef *def, unsigned int flags) { xmlNodePtr cur; - int defaultModeVal; - g_autofree char *port =3D virXMLPropString(node, "port"); - g_autofree char *tlsPort =3D virXMLPropString(node, "tlsPort"); g_autofree char *autoport =3D virXMLPropString(node, "autoport"); - g_autofree char *defaultMode =3D virXMLPropString(node, "defaultMode"); =20 if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0) return -1; =20 - if (port) { - if (virStrToLong_i(port, NULL, 10, &def->data.spice.port) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse spice port %s"), port); - return -1; - } - } else { - def->data.spice.port =3D 0; - } + def->data.spice.port =3D 0; + if (virXMLPropInt(node, "port", 10, VIR_XML_PROP_NONE, + &def->data.spice.port) < 0) + return -1; =20 - if (tlsPort) { - if (virStrToLong_i(tlsPort, NULL, 10, &def->data.spice.tlsPort) < = 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse spice tlsPort %s"), tlsPort); - return -1; - } - } else { - def->data.spice.tlsPort =3D 0; - } + def->data.spice.tlsPort =3D 0; + if (virXMLPropInt(node, "tlsPort", 10, VIR_XML_PROP_NONE, + &def->data.spice.tlsPort) < 0) + return -1; =20 if (STREQ_NULLABLE(autoport, "yes")) def->data.spice.autoport =3D true; =20 def->data.spice.defaultMode =3D VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE= _ANY; =20 - if (defaultMode) { - if ((defaultModeVal =3D virDomainGraphicsSpiceChannelModeTypeFromS= tring(defaultMode)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown default spice channel mode %s"), - defaultMode); - return -1; - } - def->data.spice.defaultMode =3D defaultModeVal; - } + if (virXMLPropEnum(node, "defaultMode", + virDomainGraphicsSpiceChannelModeTypeFromString, + VIR_XML_PROP_NONE, &def->data.spice.defaultMode) < = 0) + return -1; =20 if (def->data.spice.port =3D=3D -1 && def->data.spice.tlsPort =3D=3D -= 1) { /* Legacy compat syntax, used -1 for auto-port */ @@ -12969,200 +12950,86 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraph= icsDef *def, while (cur !=3D NULL) { if (cur->type =3D=3D XML_ELEMENT_NODE) { if (virXMLNodeNameEqual(cur, "channel")) { - int nameval, modeval; - g_autofree char *name =3D NULL; - g_autofree char *mode =3D NULL; - - name =3D virXMLPropString(cur, "name"); - mode =3D virXMLPropString(cur, "mode"); + virDomainGraphicsSpiceChannelName name; + virDomainGraphicsSpiceChannelMode mode; =20 - if (!name || !mode) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("spice channel missing name/mode")); + if (virXMLPropEnum(cur, "name", + virDomainGraphicsSpiceChannelNameTypeFr= omString, + VIR_XML_PROP_REQUIRED, &name) < 0) return -1; - } =20 - if ((nameval =3D virDomainGraphicsSpiceChannelNameTypeFrom= String(name)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown spice channel name %s"), - name); - return -1; - } - if ((modeval =3D virDomainGraphicsSpiceChannelModeTypeFrom= String(mode)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown spice channel mode %s"), - mode); + if (virXMLPropEnum(cur, "mode", + virDomainGraphicsSpiceChannelModeTypeFr= omString, + VIR_XML_PROP_REQUIRED, &mode) < 0) return -1; - } =20 - def->data.spice.channels[nameval] =3D modeval; + def->data.spice.channels[name] =3D mode; } else if (virXMLNodeNameEqual(cur, "image")) { - int compressionVal; - g_autofree char *compression =3D virXMLPropString(cur, "co= mpression"); + virDomainGraphicsSpiceImageCompression compression; =20 - if (!compression) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("spice image missing compression")); + if (virXMLPropEnum(cur, "compression", + virDomainGraphicsSpiceImageCompressionT= ypeFromString, + VIR_XML_PROP_REQUIRED, &compression) < = 0) return -1; - } =20 - if ((compressionVal =3D - virDomainGraphicsSpiceImageCompressionTypeFromString(= compression)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown spice image compression %s"), - compression); - return -1; - } - - def->data.spice.image =3D compressionVal; + def->data.spice.image =3D compression; } else if (virXMLNodeNameEqual(cur, "jpeg")) { - int compressionVal; - g_autofree char *compression =3D virXMLPropString(cur, "co= mpression"); + virDomainGraphicsSpiceJpegCompression compression; =20 - if (!compression) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("spice jpeg missing compression")); + if (virXMLPropEnum(cur, "compression", + virDomainGraphicsSpiceJpegCompressionTy= peFromString, + VIR_XML_PROP_REQUIRED, &compression) < = 0) return -1; - } =20 - if ((compressionVal =3D - virDomainGraphicsSpiceJpegCompressionTypeFromString(c= ompression)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown spice jpeg compression %s"), - compression); - return -1; - } - - def->data.spice.jpeg =3D compressionVal; + def->data.spice.jpeg =3D compression; } else if (virXMLNodeNameEqual(cur, "zlib")) { - int compressionVal; - g_autofree char *compression =3D virXMLPropString(cur, "co= mpression"); - - if (!compression) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("spice zlib missing compression")); - return -1; - } + virDomainGraphicsSpiceZlibCompression compression; =20 - if ((compressionVal =3D - virDomainGraphicsSpiceZlibCompressionTypeFromString(c= ompression)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown spice zlib compression %s"), - compression); + if (virXMLPropEnum(cur, "compression", + virDomainGraphicsSpiceZlibCompressionTy= peFromString, + VIR_XML_PROP_REQUIRED, &compression) < = 0) return -1; - } =20 - def->data.spice.zlib =3D compressionVal; + def->data.spice.zlib =3D compression; } else if (virXMLNodeNameEqual(cur, "playback")) { - int compressionVal; - g_autofree char *compression =3D virXMLPropString(cur, "co= mpression"); - - if (!compression) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("spice playback missing compression")= ); - return -1; - } - - if ((compressionVal =3D - virTristateSwitchTypeFromString(compression)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("unknown spice playback compression")= ); + if (virXMLPropTristateSwitch(cur, "compression", + VIR_XML_PROP_REQUIRED, + &def->data.spice.playback) < = 0) return -1; - } =20 - def->data.spice.playback =3D compressionVal; } else if (virXMLNodeNameEqual(cur, "streaming")) { - int modeVal; - g_autofree char *mode =3D virXMLPropString(cur, "mode"); + virDomainGraphicsSpiceStreamingMode mode; =20 - if (!mode) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("spice streaming missing mode")); - return -1; - } - if ((modeVal =3D - virDomainGraphicsSpiceStreamingModeTypeFromString(mod= e)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("unknown spice streaming mode")); + if (virXMLPropEnum(cur, "mode", + virDomainGraphicsSpiceStreamingModeType= FromString, + VIR_XML_PROP_REQUIRED, &mode) < 0) return -1; - } =20 - def->data.spice.streaming =3D modeVal; + def->data.spice.streaming =3D mode; } else if (virXMLNodeNameEqual(cur, "clipboard")) { - int copypasteVal; - g_autofree char *copypaste =3D virXMLPropString(cur, "copy= paste"); - - if (!copypaste) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("spice clipboard missing copypaste")); + if (virXMLPropTristateBool(cur, "copypaste", + VIR_XML_PROP_REQUIRED, + &def->data.spice.copypaste) < 0) return -1; - } - - if ((copypasteVal =3D - virTristateBoolTypeFromString(copypaste)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown copypaste value '%s'"), copy= paste); - return -1; - } - - def->data.spice.copypaste =3D copypasteVal; } else if (virXMLNodeNameEqual(cur, "filetransfer")) { - int enableVal; - g_autofree char *enable =3D virXMLPropString(cur, "enable"= ); - - if (!enable) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("spice filetransfer missing enable")); + if (virXMLPropTristateBool(cur, "enable", + VIR_XML_PROP_REQUIRED, + &def->data.spice.filetransfer) = < 0) return -1; - } - - if ((enableVal =3D - virTristateBoolTypeFromString(enable)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown enable value '%s'"), enable); - return -1; - } - - def->data.spice.filetransfer =3D enableVal; } else if (virXMLNodeNameEqual(cur, "gl")) { - int enableVal; - g_autofree char *enable =3D virXMLPropString(cur, "enable"= ); - g_autofree char *rendernode =3D virXMLPropString(cur, "ren= dernode"); + def->data.spice.rendernode =3D virXMLPropString(cur, + "rendernode"= ); =20 - if (!enable) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("spice gl element missing enable")); - return -1; - } - - if ((enableVal =3D - virTristateBoolTypeFromString(enable)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown enable value '%s'"), enable); + if (virXMLPropTristateBool(cur, "enable", + VIR_XML_PROP_REQUIRED, + &def->data.spice.gl) < 0) return -1; - } - - def->data.spice.gl =3D enableVal; - def->data.spice.rendernode =3D g_steal_pointer(&rendernode= ); - } else if (virXMLNodeNameEqual(cur, "mouse")) { - int modeVal; - g_autofree char *mode =3D virXMLPropString(cur, "mode"); - - if (!mode) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("spice mouse missing mode")); + if (virXMLPropEnum(cur, "mode", + virDomainGraphicsSpiceMouseModeTypeFrom= String, + VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NO= NZERO, + &def->data.spice.mousemode) < 0) return -1; - } - - if ((modeVal =3D virDomainGraphicsSpiceMouseModeTypeFromSt= ring(mode)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown mouse mode value '%s'"), - mode); - return -1; - } - - def->data.spice.mousemode =3D modeVal; } } cur =3D cur->next; --=20 2.26.3 From nobody Thu Mar 28 15:51:18 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=1619192394; cv=none; d=zohomail.com; s=zohoarc; b=Oi5yvkw7W884iR43mPmac/9jNDXGNZPubfaydABeIaAZuT5Y5hUgdyOr6rMuktKgp+/pKiIiysJWL0RaU2q+vDEIaacHArWiqtTtuxQOcAglYMByhzhNJNmGCNQvWaWEF+PsnvzQXkMGHUaHuZ+iAn4IrNAFTXCX6uBKhg4zBSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619192394; 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=Jq0CvnOK/pVVS00bBLpQ38TG/xsi2Qrwq8Y/UQXXviE=; b=jzwPcby8lKq9j1TXLf3UG7PEgYIFun5BsjKd2Lt7E8xIPBjY1sJ5UII1wb5KpLG0YwIvdRyhk06hfIGObV/SSLbauvZS0Hz1PFBQQcQuN2Yc04GG5TvDN8T2iojTttzWJmAcjlnNRzRCHMKZzS51cuWaE/hVoquRPrOubfzYYXo= 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 1619192394639588.5682756897069; Fri, 23 Apr 2021 08:39:54 -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-313-o6NS4zrpM1q2QXjb8UdXmg-1; Fri, 23 Apr 2021 11:39:49 -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 980F318B62AE; Fri, 23 Apr 2021 15:39: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 7869959454; Fri, 23 Apr 2021 15:39: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 3F9D044A5C; Fri, 23 Apr 2021 15:39:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13NFdXBT004227 for ; Fri, 23 Apr 2021 11:39:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8526E60613; Fri, 23 Apr 2021 15:39:33 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4E2A60854; Fri, 23 Apr 2021 15:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619192393; 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=Jq0CvnOK/pVVS00bBLpQ38TG/xsi2Qrwq8Y/UQXXviE=; b=XR9KTlKrsXBr4Gs4b9NwN2ecbuKB0sccpnCIcCTxblsUbc2GURBcot+T3TrVD6SynWH2Ee tEHh4TfNC/dIgzbBPZ7VXiAyJV+uLfBCmsNH5/THw2/EdZXFl+RTvL4zoejj7DAPurXqrT MLIqDYsI7UrByWK37VukT3VKZcOM+pI= X-MC-Unique: o6NS4zrpM1q2QXjb8UdXmg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] virDomainGraphicsDefParseXML: Use virXMLProp* Date: Fri, 23 Apr 2021 17:39:17 +0200 Message-Id: <20210423153923.339223-5-twiederh@redhat.com> In-Reply-To: <20210423153923.339223-1-twiederh@redhat.com> References: <20210423153923.339223-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9aba2edf0a..f599d1afe7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13097,25 +13097,13 @@ virDomainGraphicsDefParseXML(virDomainXMLOption *= xmlopt, unsigned int flags) { virDomainGraphicsDef *def; - int typeVal; - g_autofree char *type =3D NULL; =20 if (!(def =3D virDomainGraphicsDefNew(xmlopt))) return NULL; =20 - type =3D virXMLPropString(node, "type"); - if (!type) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing graphics device type")); - goto error; - } - - if ((typeVal =3D virDomainGraphicsTypeFromString(type)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown graphics device type '%s'"), type); + if (virXMLPropEnum(node, "type", virDomainGraphicsTypeFromString, + VIR_XML_PROP_REQUIRED, &def->type) < 0) goto error; - } - def->type =3D typeVal; =20 switch (def->type) { case VIR_DOMAIN_GRAPHICS_TYPE_VNC: --=20 2.26.3 From nobody Thu Mar 28 15:51:18 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=1619192394; cv=none; d=zohomail.com; s=zohoarc; b=dttBN8ESZRwmoJo7KavinzgGtBuPeCopekvg8i12/c4E90QhkLGwLd8mzIT6l2LFrZ7a+jrcXHwdsQIxSHumPzN8Ke9U6cBL8BCt0OIkX2oDaqz74T/FO1BL7cjbghlGnrhszNglt+lMGzEulsUNudFGlNMTCkr5HJ0xV6pHp/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619192394; 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=kPQBZs0Cwa9Uy4uLw1asvzg04f9cAmEq3WJWxuXLoHk=; b=j2XSK1jjeRO0UYiFKNpydJjVMt9Nh1AzVReLxcOZ796vNKoSYnAGAIk11NKciueoWpQMwmEk2ttgW4McG0YvIFoKIkQRH8aGJKI8IGJD2KDJdsMUEmOC5MgTIrjerw54NJ64ZTOoeDbXajh0cQx/tPlohU9qSifhLov7bJM9ap8= 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 1619192394053229.7843879778983; Fri, 23 Apr 2021 08:39:54 -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-252-OyCPQIWyPqyILR3Ot8alrQ-1; Fri, 23 Apr 2021 11:39: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 C5410343AE; Fri, 23 Apr 2021 15:39:45 +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 A95B96090F; Fri, 23 Apr 2021 15:39:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 743B81806D1E; Fri, 23 Apr 2021 15:39:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13NFdYKZ004239 for ; Fri, 23 Apr 2021 11:39:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id A0A9B60613; Fri, 23 Apr 2021 15:39:34 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC71D60854; Fri, 23 Apr 2021 15:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619192393; 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=kPQBZs0Cwa9Uy4uLw1asvzg04f9cAmEq3WJWxuXLoHk=; b=CNLEkr88gIqKHEdM9n8BCN2InSXjrS68S9fp3kjVG5YhQETEuTgjLHyKS3ydkB2M8Ddwa8 0aOxou9dxRzApBW4QYQBNWTHGhb0LzTwTfJTWm+KwB+bsYGrI1Ceorjj3fHvsvVh0rFxnJ 0R3jrGXBIcopteppGu0rlT+m0YpayDQ= X-MC-Unique: OyCPQIWyPqyILR3Ot8alrQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] virDomainSoundDef: Change type of model to virDomainSoundModel Date: Fri, 23 Apr 2021 17:39:18 +0200 Message-Id: <20210423153923.339223-6-twiederh@redhat.com> In-Reply-To: <20210423153923.339223-1-twiederh@redhat.com> References: <20210423153923.339223-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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 | 4 +++- src/conf/domain_conf.h | 2 +- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_domain_address.c | 2 +- src/qemu/qemu_validate.c | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f599d1afe7..50ddb293ed 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13174,17 +13174,19 @@ virDomainSoundDefParseXML(virDomainXMLOption *xml= opt, virDomainSoundDef *def; VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree char *model =3D NULL; + int modelval; xmlNodePtr audioNode; =20 def =3D g_new0(virDomainSoundDef, 1); ctxt->node =3D node; =20 model =3D virXMLPropString(node, "model"); - if ((def->model =3D virDomainSoundModelTypeFromString(model)) < 0) { + if ((modelval =3D virDomainSoundModelTypeFromString(model)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown sound model '%s'"), model); goto error; } + def->model =3D modelval; =20 if (virDomainSoundModelSupportsCodecs(def)) { int ncodecs; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4838687edf..ede80ac322 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1449,7 +1449,7 @@ struct _virDomainSoundCodecDef { }; =20 struct _virDomainSoundDef { - int model; + virDomainSoundModel model; virDomainDeviceInfo info; =20 size_t ncodecs; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index be93182092..d7f1c715b6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4133,7 +4133,7 @@ qemuBuildSoundDevStr(const virDomainDef *def, const char *model =3D NULL; =20 /* Hack for devices with different names in QEMU and libvirt */ - switch ((virDomainSoundModel) sound->model) { + switch (sound->model) { case VIR_DOMAIN_SOUND_MODEL_ES1370: model =3D "ES1370"; break; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index a73f30ddcb..e66efb3d1f 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -759,7 +759,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDef *dev, } =20 case VIR_DOMAIN_DEVICE_SOUND: - switch ((virDomainSoundModel) dev->data.sound->model) { + switch (dev->data.sound->model) { case VIR_DOMAIN_SOUND_MODEL_ES1370: case VIR_DOMAIN_SOUND_MODEL_AC97: case VIR_DOMAIN_SOUND_MODEL_ICH6: diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 255d653118..774426bceb 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4385,7 +4385,7 @@ qemuValidateDomainDeviceDefSound(virDomainSoundDef *s= ound, { size_t i; =20 - switch ((virDomainSoundModel) sound->model) { + switch (sound->model) { case VIR_DOMAIN_SOUND_MODEL_USB: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_USB_AUDIO)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", --=20 2.26.3 From nobody Thu Mar 28 15:51:18 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=1619192400; cv=none; d=zohomail.com; s=zohoarc; b=jhblXgDy+a+ari+CPgAj11XxYt9vpQ7KhjRsmcDnMfEELgXTLwHB4k+ylS8BdZW93qcujEebM98vZs7AmbFmzsD72npkdga6OBsvmNi9Iq4scfPq/NeJ6Yw04uknOu70PF1j7VbGE5gPaMLOUw2Ii8CbOYJTut07C3YKXOWvfVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619192400; 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=Kpl/6AbYJY2Ud/57XHAcbeyVBUjL8EHXaYWpv8YOl6s=; b=X1de8ZBDbRN//aEb42bl9t0C3nD2k6sYxflVPI2nB02FkpLPogk1c+7IydAS4UZtqQC/buWVRlX76+nhKk49Sgt/3hd+NLoU63YUDeDZYvtb9CHOKlIrcltFjB5HQiJt00x0kRsXhmfASO+hF0ozxQ045PW7RznA/Hyomyw8UP0= 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 161919240008322.380278403821876; Fri, 23 Apr 2021 08:40: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-165-CP66LN-RMF6RK67VIOoy7Q-1; Fri, 23 Apr 2021 11:39:56 -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 062BF343AA; Fri, 23 Apr 2021 15:39:49 +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 D251D1B5FB; Fri, 23 Apr 2021 15:39:48 +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 9A39344A68; Fri, 23 Apr 2021 15:39:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13NFdZsI004244 for ; Fri, 23 Apr 2021 11:39:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id BEA176090F; Fri, 23 Apr 2021 15:39:35 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0441460854; Fri, 23 Apr 2021 15:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619192399; 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=Kpl/6AbYJY2Ud/57XHAcbeyVBUjL8EHXaYWpv8YOl6s=; b=NYP4BlvPqSI8xzVnCWTLrGq3ghIupJLfcqmfIFzgBr2fiXiqdCJ5NcC4ZELy4LqLzjkVfb D6yIjQTY1sGb6D/6wwtV8oJVrlwX/pUuDBqAnULNMCZfm5HIlTMtvmoi8iU8nNwca6zH+n ow/TW2khcqzpgtG6KgNAfMsJaz3skKM= X-MC-Unique: CP66LN-RMF6RK67VIOoy7Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] virDomainSoundDefParseXML: Use virXMLProp* Date: Fri, 23 Apr 2021 17:39:19 +0200 Message-Id: <20210423153923.339223-7-twiederh@redhat.com> In-Reply-To: <20210423153923.339223-1-twiederh@redhat.com> References: <20210423153923.339223-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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 | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 50ddb293ed..867a83a605 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13173,20 +13173,14 @@ virDomainSoundDefParseXML(virDomainXMLOption *xml= opt, { virDomainSoundDef *def; VIR_XPATH_NODE_AUTORESTORE(ctxt) - g_autofree char *model =3D NULL; - int modelval; xmlNodePtr audioNode; =20 def =3D g_new0(virDomainSoundDef, 1); ctxt->node =3D node; =20 - model =3D virXMLPropString(node, "model"); - if ((modelval =3D virDomainSoundModelTypeFromString(model)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown sound model '%s'"), model); + if (virXMLPropEnum(node, "model", virDomainSoundModelTypeFromString, + VIR_XML_PROP_REQUIRED, &def->model) < 0) goto error; - } - def->model =3D modelval; =20 if (virDomainSoundModelSupportsCodecs(def)) { int ncodecs; @@ -13215,19 +13209,10 @@ virDomainSoundDefParseXML(virDomainXMLOption *xml= opt, =20 audioNode =3D virXPathNode("./audio", ctxt); if (audioNode) { - g_autofree char *tmp =3D NULL; - tmp =3D virXMLPropString(audioNode, "id"); - if (!tmp) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing audio 'id' attribute")); - goto error; - } - if (virStrToLong_ui(tmp, NULL, 10, &def->audioId) < 0 || - def->audioId =3D=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid audio 'id' value '%s'"), tmp); + if (virXMLPropUInt(audioNode, "id", 10, + VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO, + &def->audioId) < 0) goto error; - } } =20 if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags)= < 0) --=20 2.26.3 From nobody Thu Mar 28 15:51:18 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=1619192466; cv=none; d=zohomail.com; s=zohoarc; b=MOfE1jJgMSJlCcHVb2nHtQxZK1uJVpy/dHt9EVvDB8IGg8jksGiOSD/wD0RRDArjdPUmGKoMJNLRNfF8Y3FWI4nZSA9EC7okIxwOtHbrmMlnIa+93yJhfm9Rx2URCmvfBie47i5wdrB8xKfDFFi9lKbCf0CJixMj95uWM9LNSHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619192466; 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=53vc5oyf575YOXMybQTjBxdWEDLj9e7mwsNEkpNuxwY=; b=MRSjMRBnszgitHRoAV4Lq4HuEKQM3od9Yj3s9ob3fA/L3polrzSrLEM3Dh3iUjOk8TYVyQasvkOHyMakEaF8/Z1Fbv+onBCNfWACpeP8ry5vm6jHObWQ09KVo3PnNwkHmiW6lWCyn/ah7NdtL88/As2O+FCp4SGs3EEyvKOikHI= 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 1619192466280234.91212915105598; Fri, 23 Apr 2021 08:41:06 -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-528-vpsOmrIYNXaKaPgBuFKy0A-1; Fri, 23 Apr 2021 11:39:58 -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 2465B343AE; Fri, 23 Apr 2021 15:39: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 E730119714; Fri, 23 Apr 2021 15:39: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 A8E8A44A6B; Fri, 23 Apr 2021 15:39:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13NFdaf2004254 for ; Fri, 23 Apr 2021 11:39:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id DBCBC60613; Fri, 23 Apr 2021 15:39:36 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23DF160854; Fri, 23 Apr 2021 15:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619192465; 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=53vc5oyf575YOXMybQTjBxdWEDLj9e7mwsNEkpNuxwY=; b=YrUQeoLXjgsUPIcnXxgRG+yZzlTTNFF+jyi5udRtBc60/78aVIybi08J9e4gSlbzN9fh/B +obWCV0v3+uedV8Ekmn/MMFD8QsVAUPpCFX2gIluBYJ3Tr+EJRAxIb3aA/w54i2zHusp8x RFLXYcKNXGWBp+bA0HTnHIYyoZAsLIk= X-MC-Unique: vpsOmrIYNXaKaPgBuFKy0A-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] virDomainDef: Change type of hyperv_stimer_direct to virTristateSwitch Date: Fri, 23 Apr 2021 17:39:20 +0200 Message-Id: <20210423153923.339223-8-twiederh@redhat.com> In-Reply-To: <20210423153923.339223-1-twiederh@redhat.com> References: <20210423153923.339223-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.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: Peter Krempa --- src/conf/domain_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ede80ac322..61f2d10d89 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2755,7 +2755,7 @@ struct _virDomainDef { int xen_features[VIR_DOMAIN_XEN_LAST]; int xen_passthrough_mode; unsigned int hyperv_spinlocks; - int hyperv_stimer_direct; + virTristateSwitch hyperv_stimer_direct; virGICVersion gic_version; virDomainHPTResizing hpt_resizing; unsigned long long hpt_maxpagesize; /* Stored in KiB */ --=20 2.26.3 From nobody Thu Mar 28 15:51:18 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=1619192404; cv=none; d=zohomail.com; s=zohoarc; b=ErRbIxS0CUbNnAZvgJjEXKMcvx1Ckjg5dsRSKD87DOevwfafsvI9/VupU/qderYZkkFowGSmwNJtxDqOhaqPTu42cV/JlaE8nQwOrZXugeki/T92sGF2848A4suNwkisggwzD8+ai6dd+eQVdpIo0mc5JdJKgC7JMzFL7cJktXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619192404; 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=bHqHvioUpY/rmT7OKJObs9u5ATbWWRmCfr5d8kPCJ4o=; b=a68OFkOsoi8+WeQx/mzrfzQa1/NFHwLjqq1RvUUPohyBysAOVjyhVPyFA9ZLqYb5/d6P/bi5POuP4j735aKMwJ1DdVNqL50AMEcjplZLpuYFHC27vCGsYGjIxpzZFBqfTJcfkm+J6FY4634+dNih4LfqnaJJ4x/ufin/VS9/ai4= 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 1619192404532801.2633809410761; Fri, 23 Apr 2021 08:40:04 -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-521-vjFGrfCaNKmG5DgNssSbvA-1; Fri, 23 Apr 2021 11:39:52 -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 6E78D805725; Fri, 23 Apr 2021 15:39: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 51AF15D6D1; Fri, 23 Apr 2021 15:39:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F3B0544A64; Fri, 23 Apr 2021 15:39:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13NFdcih004270 for ; Fri, 23 Apr 2021 11:39:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0404317DC3; Fri, 23 Apr 2021 15:39:38 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F5AA60854; Fri, 23 Apr 2021 15:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619192403; 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=bHqHvioUpY/rmT7OKJObs9u5ATbWWRmCfr5d8kPCJ4o=; b=fEcz6PiYpQHqwzuhhfpxX9F1qocK1wTGv0elPP0UoeIucZ5qOpQr8k/1vFXJQMF8W9vfjQ 3AVv1tCXK0npXYCKcTVTQFJBBSJCpLDXXq49uK3b0b55Roc8cvAtw/L3hNVkp0tOznEa1r JbkrujSCTL2NvKGXLGdQ60U5UmPKXPM= X-MC-Unique: vjFGrfCaNKmG5DgNssSbvA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] virDomainDef: Change type of xen_passthrough_mode to virDomainXenPassthroughMode Date: Fri, 23 Apr 2021 17:39:21 +0200 Message-Id: <20210423153923.339223-9-twiederh@redhat.com> In-Reply-To: <20210423153923.339223-1-twiederh@redhat.com> References: <20210423153923.339223-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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: Peter Krempa --- src/conf/domain_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 61f2d10d89..85c318d027 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2753,7 +2753,7 @@ struct _virDomainDef { int kvm_features[VIR_DOMAIN_KVM_LAST]; int msrs_features[VIR_DOMAIN_MSRS_LAST]; int xen_features[VIR_DOMAIN_XEN_LAST]; - int xen_passthrough_mode; + virDomainXenPassthroughMode xen_passthrough_mode; unsigned int hyperv_spinlocks; virTristateSwitch hyperv_stimer_direct; virGICVersion gic_version; --=20 2.26.3 From nobody Thu Mar 28 15:51:18 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=1619192436; cv=none; d=zohomail.com; s=zohoarc; b=BizzBMMdNZaaxqFss+2+QNiKR8r8m0qcixm2F6ty46mpQMDNXlfxGEaOCwTl1ne4cMy9AiuN5MbkY944GYDziibdPvBnTIPowlQClEsYyLR2PE2J/p/nf0XYFLMhKskjeJKFB5H/TRhrrO+SNMLyIvWwDSih1OxcFszNVSBt+hs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619192436; 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=T/WaPEm16NrVCGgAVSfTuvw538NsKOs7E1PMMufqQrk=; b=O2uEfmVg+sofOnjRM3fjt/klcYxZkXrpeBH/Gkpw/hI3HqJ66QPnDJiPIQqZC+bCy2VCFmv0zb2MiMuk2iOtrTgOkp39ouPcUWrr96g8+AXrpvBr9pFAArMP7J9KZV+0vT+uNzd0FRzaB6Qmph45Mbtdd7dTxE3aYY5/9QXAcqo= 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 1619192436415164.70390616869406; Fri, 23 Apr 2021 08:40:36 -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-498-yZ1waiZvN8e4zqY5Qc18yQ-1; Fri, 23 Apr 2021 11:39:47 -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 2F86D1006706; Fri, 23 Apr 2021 15:39:42 +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 01C6019714; Fri, 23 Apr 2021 15:39: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 C311B180B617; Fri, 23 Apr 2021 15:39:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13NFddU0004277 for ; Fri, 23 Apr 2021 11:39:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E3EE60613; Fri, 23 Apr 2021 15:39:39 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CAB060854; Fri, 23 Apr 2021 15:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619192435; 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=T/WaPEm16NrVCGgAVSfTuvw538NsKOs7E1PMMufqQrk=; b=HFhn2QH79hKw37uXvong+RkiYiTBhaCemyTDIy/yjb9SbCyiTh7V62vt62DLFe+NHsYI0J OtcehLlOC2dSb6CKRKL16S/rlSQ4JDCb9diOw5bsURh6tw8TbTtYV3JVQ/Wde+Li3crNte gRpeUKmrZpZYXOlB4w9lAkGxyTtVAQw= X-MC-Unique: yZ1waiZvN8e4zqY5Qc18yQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] virDomainFeaturesDefParse: Use virXMLProp* Date: Fri, 23 Apr 2021 17:39:22 +0200 Message-Id: <20210423153923.339223-10-twiederh@redhat.com> In-Reply-To: <20210423153923.339223-1-twiederh@redhat.com> References: <20210423153923.339223-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.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: Peter Krempa --- src/conf/domain_conf.c | 333 +++++++----------- .../qemuxml2argvdata/aarch64-gic-invalid.err | 2 +- 2 files changed, 119 insertions(+), 216 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 867a83a605..bff17057af 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17858,6 +17858,7 @@ virDomainFeaturesDefParse(virDomainDef *def, g_autofree xmlNodePtr *nodes =3D NULL; size_t i; int n; + int rc; =20 if ((n =3D virXPathNodeSet("./features/*", ctxt, &nodes)) < 0) return -1; @@ -17895,76 +17896,67 @@ virDomainFeaturesDefParse(virDomainDef *def, def->features[val] =3D VIR_TRISTATE_SWITCH_ON; break; =20 - case VIR_DOMAIN_FEATURE_CAPABILITIES: - if ((tmp =3D virXMLPropString(nodes[i], "policy"))) { - if ((def->features[val] =3D virDomainCapabilitiesPolicyTyp= eFromString(tmp)) =3D=3D -1) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown policy attribute '%s' of fea= ture '%s'"), - tmp, virDomainFeatureTypeToString(val)); - return -1; - } - } else { - def->features[val] =3D VIR_TRISTATE_SWITCH_ABSENT; - } + case VIR_DOMAIN_FEATURE_CAPABILITIES: { + virDomainCapabilitiesPolicy policy; + + def->features[val] =3D VIR_TRISTATE_SWITCH_ABSENT; + + if ((rc =3D virXMLPropEnum(nodes[i], "policy", + virDomainCapabilitiesPolicyTypeFromSt= ring, + VIR_XML_PROP_NONE, &policy)) < 0) + return -1; + + if (rc =3D=3D 1) + def->features[val] =3D policy; break; + } =20 case VIR_DOMAIN_FEATURE_VMCOREINFO: case VIR_DOMAIN_FEATURE_HAP: case VIR_DOMAIN_FEATURE_PMU: case VIR_DOMAIN_FEATURE_PVSPINLOCK: case VIR_DOMAIN_FEATURE_VMPORT: - case VIR_DOMAIN_FEATURE_SMM: - if ((tmp =3D virXMLPropString(nodes[i], "state"))) { - if ((def->features[val] =3D virTristateSwitchTypeFromStrin= g(tmp)) =3D=3D -1) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown state attribute '%s' of feat= ure '%s'"), - tmp, virDomainFeatureTypeToString(val)); - return -1; - } - } else { - def->features[val] =3D VIR_TRISTATE_SWITCH_ON; - } + case VIR_DOMAIN_FEATURE_SMM: { + virTristateSwitch state; + + def->features[val] =3D VIR_TRISTATE_SWITCH_ON; + + if ((rc =3D virXMLPropTristateSwitch(nodes[i], "state", + VIR_XML_PROP_NONE, &state))= < 0) + return -1; + + if (rc =3D=3D 1) + def->features[val] =3D state; break; + } =20 case VIR_DOMAIN_FEATURE_GIC: - if ((tmp =3D virXMLPropString(nodes[i], "version"))) { - int gic_version =3D virGICVersionTypeFromString(tmp); - if (gic_version < 0 || gic_version =3D=3D VIR_GIC_VERSION_= NONE) { - virReportError(VIR_ERR_XML_ERROR, - _("malformed gic version: %s"), tmp); - return -1; - } - def->gic_version =3D gic_version; - } def->features[val] =3D VIR_TRISTATE_SWITCH_ON; + + if (virXMLPropEnum(nodes[i], "version", + virGICVersionTypeFromString, + VIR_XML_PROP_NONZERO, &def->gic_version) < = 0) + return -1; break; =20 - case VIR_DOMAIN_FEATURE_IOAPIC: - tmp =3D virXMLPropString(nodes[i], "driver"); - if (tmp) { - int value =3D virDomainIOAPICTypeFromString(tmp); - if (value < 0 || value =3D=3D VIR_DOMAIN_IOAPIC_NONE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown driver mode: %s"), - tmp); - return -1; - } - def->features[val] =3D value; - } + case VIR_DOMAIN_FEATURE_IOAPIC: { + virDomainIOAPIC driver; + + if ((rc =3D virXMLPropEnum(nodes[i], "driver", + virDomainIOAPICTypeFromString, + VIR_XML_PROP_NONZERO, &driver)) < 0) + return -1; + + if (rc =3D=3D 1) + def->features[val] =3D driver; break; + } =20 case VIR_DOMAIN_FEATURE_HPT: - tmp =3D virXMLPropString(nodes[i], "resizing"); - if (tmp) { - int value =3D virDomainHPTResizingTypeFromString(tmp); - if (value < 0 || value =3D=3D VIR_DOMAIN_HPT_RESIZING_NONE= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown HPT resizing setting: %s"), - tmp); - return -1; - } - def->hpt_resizing =3D (virDomainHPTResizing) value; - } + if (virXMLPropEnum(nodes[i], "resizing", + virDomainHPTResizingTypeFromString, + VIR_XML_PROP_NONZERO, &def->hpt_resizing) <= 0) + return -1; =20 if (virParseScaledValue("./features/hpt/maxpagesize", NULL, @@ -17986,64 +17978,57 @@ virDomainFeaturesDefParse(virDomainDef *def, } break; =20 - case VIR_DOMAIN_FEATURE_CFPC: - tmp =3D virXMLPropString(nodes[i], "value"); - if (tmp) { - int value =3D virDomainCFPCTypeFromString(tmp); - if (value < 0 || value =3D=3D VIR_DOMAIN_CFPC_NONE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown value: %s"), - tmp); - return -1; - } + case VIR_DOMAIN_FEATURE_CFPC: { + virDomainCFPC value; + + if ((rc =3D virXMLPropEnum(nodes[i], "value", + virDomainCFPCTypeFromString, + VIR_XML_PROP_NONZERO, &value)) < 0) + return -1; + + if (rc =3D=3D 1) def->features[val] =3D value; - } break; + } =20 - case VIR_DOMAIN_FEATURE_SBBC: - tmp =3D virXMLPropString(nodes[i], "value"); - if (tmp) { - int value =3D virDomainSBBCTypeFromString(tmp); - if (value < 0 || value =3D=3D VIR_DOMAIN_SBBC_NONE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown value: %s"), - tmp); - return -1; - } + case VIR_DOMAIN_FEATURE_SBBC: { + virDomainSBBC value; + + if ((rc =3D virXMLPropEnum(nodes[i], "value", + virDomainSBBCTypeFromString, + VIR_XML_PROP_NONZERO, &value)) < 0) + return -1; + + if (rc =3D=3D 1) def->features[val] =3D value; - } break; + } =20 - case VIR_DOMAIN_FEATURE_IBS: - tmp =3D virXMLPropString(nodes[i], "value"); - if (tmp) { - int value =3D virDomainIBSTypeFromString(tmp); - if (value < 0 || value =3D=3D VIR_DOMAIN_IBS_NONE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown value: %s"), - tmp); - return -1; - } + case VIR_DOMAIN_FEATURE_IBS: { + virDomainIBS value; + + if ((rc =3D virXMLPropEnum(nodes[i], "value", + virDomainIBSTypeFromString, + VIR_XML_PROP_NONZERO, &value)) < 0) + return -1; + + if (rc =3D=3D 1) def->features[val] =3D value; - } break; + } =20 case VIR_DOMAIN_FEATURE_HTM: case VIR_DOMAIN_FEATURE_NESTED_HV: - case VIR_DOMAIN_FEATURE_CCF_ASSIST: - if (!(tmp =3D virXMLPropString(nodes[i], "state"))) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("missing state attribute '%s' of feature = '%s'"), - tmp, virDomainFeatureTypeToString(val)); - return -1; - } - if ((def->features[val] =3D virTristateSwitchTypeFromString(tm= p)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown state attribute '%s' of feature = '%s'"), - tmp, virDomainFeatureTypeToString(val)); + case VIR_DOMAIN_FEATURE_CCF_ASSIST: { + virTristateSwitch state; + + if (virXMLPropTristateSwitch(nodes[i], "state", + VIR_XML_PROP_REQUIRED, &state) < = 0) return -1; - } + + def->features[val] =3D state; break; + } =20 /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: @@ -18054,13 +18039,12 @@ virDomainFeaturesDefParse(virDomainDef *def, =20 if (def->features[VIR_DOMAIN_FEATURE_HYPERV] =3D=3D VIR_TRISTATE_SWITC= H_ON) { int feature; - int value; xmlNodePtr node =3D ctxt->node; if ((n =3D virXPathNodeSet("./features/hyperv/*", ctxt, &nodes)) <= 0) return -1; =20 for (i =3D 0; i < n; i++) { - g_autofree char *tmp =3D NULL; + virTristateSwitch value; feature =3D virDomainHypervTypeFromString((const char *)nodes[= i]->name); if (feature < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -18071,21 +18055,9 @@ virDomainFeaturesDefParse(virDomainDef *def, =20 ctxt->node =3D nodes[i]; =20 - if (!(tmp =3D virXMLPropString(nodes[i], "state"))) { - virReportError(VIR_ERR_XML_ERROR, - _("missing 'state' attribute for " - "HyperV Enlightenment feature '%s'"), - nodes[i]->name); - return -1; - } - - if ((value =3D virTristateSwitchTypeFromString(tmp)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid value of state argument " - "for HyperV Enlightenment feature '%s'"), - nodes[i]->name); + if (virXMLPropTristateSwitch(nodes[i], "state", + VIR_XML_PROP_REQUIRED, &value) < = 0) return -1; - } =20 def->hyperv_features[feature] =3D value; =20 @@ -18108,12 +18080,10 @@ virDomainFeaturesDefParse(virDomainDef *def, if (value !=3D VIR_TRISTATE_SWITCH_ON) break; =20 - if (virXPathUInt("string(./@retries)", ctxt, - &def->hyperv_spinlocks) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("invalid HyperV spinlock retry count"= )); + if (virXMLPropUInt(nodes[i], "retries", 0, + VIR_XML_PROP_REQUIRED, + &def->hyperv_spinlocks) < 0) return -1; - } =20 if (def->hyperv_spinlocks < 0xFFF) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -18161,13 +18131,10 @@ virDomainFeaturesDefParse(virDomainDef *def, } =20 if (def->hyperv_features[VIR_DOMAIN_HYPERV_STIMER] =3D=3D VIR_TRISTATE= _SWITCH_ON) { - int value; if ((n =3D virXPathNodeSet("./features/hyperv/stimer/*", ctxt, &no= des)) < 0) return -1; =20 for (i =3D 0; i < n; i++) { - g_autofree char *tmp =3D NULL; - if (STRNEQ((const char *)nodes[i]->name, "direct")) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported Hyper-V stimer feature: %s"), @@ -18175,33 +18142,21 @@ virDomainFeaturesDefParse(virDomainDef *def, return -1; } =20 - if (!(tmp =3D virXMLPropString(nodes[i], "state"))) { - virReportError(VIR_ERR_XML_ERROR, - _("missing 'state' attribute for " - "Hyper-V stimer '%s' feature"), "direct"); - return -1; - } - - if ((value =3D virTristateSwitchTypeFromString(tmp)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid value of state argument " - "for Hyper-V stimer '%s' feature"), "dire= ct"); + if (virXMLPropTristateSwitch(nodes[i], "state", + VIR_XML_PROP_REQUIRED, + &def->hyperv_stimer_direct) < 0) return -1; - } - - def->hyperv_stimer_direct =3D value; } VIR_FREE(nodes); } =20 if (def->features[VIR_DOMAIN_FEATURE_KVM] =3D=3D VIR_TRISTATE_SWITCH_O= N) { - int feature; - int value; if ((n =3D virXPathNodeSet("./features/kvm/*", ctxt, &nodes)) < 0) return -1; =20 for (i =3D 0; i < n; i++) { - g_autofree char *tmp =3D NULL; + virTristateSwitch value; + int feature; =20 feature =3D virDomainKVMTypeFromString((const char *)nodes[i]-= >name); if (feature < 0) { @@ -18215,21 +18170,10 @@ virDomainFeaturesDefParse(virDomainDef *def, case VIR_DOMAIN_KVM_HIDDEN: case VIR_DOMAIN_KVM_DEDICATED: case VIR_DOMAIN_KVM_POLLCONTROL: - if (!(tmp =3D virXMLPropString(nodes[i], "state"))) { - virReportError(VIR_ERR_XML_ERROR, - _("missing 'state' attribute for " - "KVM feature '%s'"), - nodes[i]->name); + if (virXMLPropTristateSwitch(nodes[i], "state", + VIR_XML_PROP_REQUIRED, + &value) < 0) return -1; - } - - if ((value =3D virTristateSwitchTypeFromString(tmp)) <= 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid value of state argument " - "for KVM feature '%s'"), - nodes[i]->name); - return -1; - } =20 def->kvm_features[feature] =3D value; break; @@ -18243,15 +18187,12 @@ virDomainFeaturesDefParse(virDomainDef *def, } =20 if (def->features[VIR_DOMAIN_FEATURE_XEN] =3D=3D VIR_TRISTATE_SWITCH_O= N) { - int feature; - int value; - g_autofree char *ptval =3D NULL; - if ((n =3D virXPathNodeSet("./features/xen/*", ctxt, &nodes)) < 0) return -1; =20 for (i =3D 0; i < n; i++) { - g_autofree char *tmp =3D NULL; + virTristateSwitch value; + int feature; feature =3D virDomainXenTypeFromString((const char *)nodes[i]-= >name); if (feature < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -18260,21 +18201,9 @@ virDomainFeaturesDefParse(virDomainDef *def, return -1; } =20 - if (!(tmp =3D virXMLPropString(nodes[i], "state"))) { - virReportError(VIR_ERR_XML_ERROR, - _("missing 'state' attribute for " - "Xen feature '%s'"), - nodes[i]->name); - return -1; - } - - if ((value =3D virTristateSwitchTypeFromString(tmp)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid value of state argument " - "for Xen feature '%s'"), - nodes[i]->name); + if (virXMLPropTristateSwitch(nodes[i], "state", + VIR_XML_PROP_REQUIRED, &value) < = 0) return -1; - } =20 def->xen_features[feature] =3D value; =20 @@ -18286,25 +18215,11 @@ virDomainFeaturesDefParse(virDomainDef *def, if (value !=3D VIR_TRISTATE_SWITCH_ON) break; =20 - if ((ptval =3D virXMLPropString(nodes[i], "mode"))) { - int mode =3D virDomainXenPassthroughModeTypeFromString= (ptval); - - if (mode < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported mode '%s' for Xen pa= ssthrough feature"), - ptval); - return -1; - } - - if (mode !=3D VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT = && - mode !=3D VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT= ) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("'mode' attribute for Xen feature= " - "'passthrough' must be 'sync_pt' = or 'share_pt'")); - return -1; - } - def->xen_passthrough_mode =3D mode; - } + if (virXMLPropEnum(nodes[i], "mode", + virDomainXenPassthroughModeTypeFromStri= ng, + VIR_XML_PROP_NONZERO, + &def->xen_passthrough_mode) < 0) + return -1; break; =20 /* coverity[dead_error_begin] */ @@ -18329,31 +18244,23 @@ virDomainFeaturesDefParse(virDomainDef *def, } =20 if (def->features[VIR_DOMAIN_FEATURE_MSRS] =3D=3D VIR_TRISTATE_SWITCH_= ON) { - g_autofree char *tmp =3D NULL; + virDomainMsrsUnknown unknown; xmlNodePtr node =3D NULL; if ((node =3D virXPathNode("./features/msrs", ctxt)) =3D=3D NULL) return -1; =20 - if (!(tmp =3D virXMLPropString(node, "unknown"))) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("missing 'unknown' attribute for feature '%s'= "), - virDomainFeatureTypeToString(VIR_DOMAIN_FEATURE= _MSRS)); + if (virXMLPropEnum(node, "unknown", virDomainMsrsUnknownTypeFromSt= ring, + VIR_XML_PROP_REQUIRED, &unknown) < 0) return -1; - } =20 - if ((def->msrs_features[VIR_DOMAIN_MSRS_UNKNOWN] =3D virDomainMsrs= UnknownTypeFromString(tmp)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown 'unknown' value '%s'"), - tmp); - return -1; - } + def->msrs_features[VIR_DOMAIN_MSRS_UNKNOWN] =3D unknown; } =20 if ((n =3D virXPathNodeSet("./features/capabilities/*", ctxt, &nodes))= < 0) return -1; =20 for (i =3D 0; i < n; i++) { - g_autofree char *tmp =3D NULL; + virTristateSwitch state =3D VIR_TRISTATE_SWITCH_ON; int val =3D virDomainProcessCapsFeatureTypeFromString((const char = *)nodes[i]->name); if (val < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -18361,16 +18268,12 @@ virDomainFeaturesDefParse(virDomainDef *def, return -1; } =20 - if ((tmp =3D virXMLPropString(nodes[i], "state"))) { - if ((def->caps_features[val] =3D virTristateSwitchTypeFromStri= ng(tmp)) =3D=3D -1) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown state attribute '%s' of feature = capability '%s'"), - tmp, virDomainProcessCapsFeatureTypeToStrin= g(val)); - return -1; - } - } else { - def->caps_features[val] =3D VIR_TRISTATE_SWITCH_ON; - } + + if (virXMLPropTristateSwitch(nodes[i], "state", VIR_XML_PROP_NONE, + &state) < 0) + return -1; + + def->caps_features[val] =3D state; } VIR_FREE(nodes); return 0; diff --git a/tests/qemuxml2argvdata/aarch64-gic-invalid.err b/tests/qemuxml= 2argvdata/aarch64-gic-invalid.err index c2e9f4aa3f..18de19f660 100644 --- a/tests/qemuxml2argvdata/aarch64-gic-invalid.err +++ b/tests/qemuxml2argvdata/aarch64-gic-invalid.err @@ -1 +1 @@ -XML error: malformed gic version: none +XML error: Invalid value for attribute 'version' in element 'gic': 'none'. --=20 2.26.3 From nobody Thu Mar 28 15:51:18 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=1619192397; cv=none; d=zohomail.com; s=zohoarc; b=joc0WQiQkxIQCgizt+7ucFJpJyG28o9cC4WaGr1dYn26U/vj9xM+03UOf3ZemHgaZCddQBbL2cz9qznMWjGshz9CT5XEPuTkWoICgCXplgEPaqs+L3xnGf/0nVYCdRnSglrvoxbGt6fM4M43i5hXyjt5Wp8Y8iJ62Wik0G93LpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619192397; 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=0qxmvVx/hyGKtV8+pwkqlbO+JG0RjVy/TkHriVtQTuA=; b=YuUIMoqj5rYDlqZKFopq2peLtu164OR5krP6n6BZdUHXAu6Ggizw4nMCSNjP5u/PeQyvrJAVT1FtpzJQc/0hghf91VktfZ0NaTZpHgdT/dtpod85BrqrIXO+EFWficolZyarOFhoiYHLy99INf6bkxD0/jfw/q+pgEGgXcGJn2I= 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 1619192397846943.8481677375576; Fri, 23 Apr 2021 08:39:57 -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-473-F1ORDE-QP-evWTx7DCwTuw-1; Fri, 23 Apr 2021 11:39:54 -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 8EF698026AD; Fri, 23 Apr 2021 15:39:47 +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 6845C19714; Fri, 23 Apr 2021 15:39:47 +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 37CD21806D21; Fri, 23 Apr 2021 15:39:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13NFdeXd004282 for ; Fri, 23 Apr 2021 11:39:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6BABE60C5A; Fri, 23 Apr 2021 15:39:40 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id A71C560854; Fri, 23 Apr 2021 15:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619192396; 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=0qxmvVx/hyGKtV8+pwkqlbO+JG0RjVy/TkHriVtQTuA=; b=fgG2jHLlsOknef9Ld7Hh0R3rX4AQtfXo7xAPg7iLXldWG0W87PeJLWseIj6fZEkDQpU0lR 9E3dDi3rtBvoHKNCO2bwW4qd7Rnsdm6pPAKzTLqeSpJDoU9GdXwUHIkpClGbYtJ5tBunyX nhKmOXWa1y+arQYTVArQSiJHUb82ATE= X-MC-Unique: F1ORDE-QP-evWTx7DCwTuw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] virDomainAudioSDLParse: Use virXMLProp* Date: Fri, 23 Apr 2021 17:39:23 +0200 Message-Id: <20210423153923.339223-11-twiederh@redhat.com> In-Reply-To: <20210423153923.339223-1-twiederh@redhat.com> References: <20210423153923.339223-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.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" This strictens the parser to disallow negative values (interpreted as `UINT_MAX + value + 1`) for attribute `bufferCount`. 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 bff17057af..12bdc12f54 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13455,15 +13455,9 @@ static int virDomainAudioSDLParse(virDomainAudioIOSDL *def, xmlNodePtr node) { - g_autofree char *bufferCount =3D virXMLPropString(node, "bufferCount"); - - if (bufferCount && - virStrToLong_ui(bufferCount, NULL, 10, - &def->bufferCount) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("cannot parse 'bufferCount' value '%s'"), bufferC= ount); + if (virXMLPropUInt(node, "bufferCount", 10, VIR_XML_PROP_NONE, + &def->bufferCount) < 0) return -1; - } =20 return 0; } --=20 2.26.3