From nobody Mon Feb 9 13:57:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1617796153; cv=none; d=zohomail.com; s=zohoarc; b=cBCiS7Iu/stgrEcP/oP7odkscEuA9Hlg98xKdewHNR2KU9tD92yubijFlsGpwblqyVYvsGj2YinR6Pjs2wUzwNXbxOnNMfY+JUAO7/L+6viDvVvaDnjma9Yuh3EBJnHxYF0bd/qHdiu0+J6Fdlv9ErqVGaWYsLMIlFUDMABuRIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617796153; 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=VPVxchz9LUVXrCMhsAs7kgOHYBaifQRSbllUONap+cw=; b=RFmxRDmY6WJvKDemtLP7RVoZnyvmGKy5rKPRR2Aurz90ve+tj/AzN+ihjHsjy6Koz5ABhyu4t/20QGd3ebFZCrr4cCK9hvyOcTtLhDhAXIaYBNnt7bAVw3ZFMFlgTDoTBf5VnkC7nlXDWeWcRMK5M1cRYTnzEVZl3jMxkIyI7qs= 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 1617796153064286.3361516163575; Wed, 7 Apr 2021 04:49: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-192-bn6veVj0MBGvet_gRywybA-1; Wed, 07 Apr 2021 07:49:09 -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 D0DAF1883545; Wed, 7 Apr 2021 11:49:01 +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 840232B1CD; Wed, 7 Apr 2021 11:49: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 402991809C82; Wed, 7 Apr 2021 11:49:01 +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 137BmoPq006759 for ; Wed, 7 Apr 2021 07:48:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 87FAF14108; Wed, 7 Apr 2021 11:48:50 +0000 (UTC) Received: from work.redhat.com (ovpn-113-23.ams2.redhat.com [10.36.113.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE51D50DE6; Wed, 7 Apr 2021 11:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617796151; 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=VPVxchz9LUVXrCMhsAs7kgOHYBaifQRSbllUONap+cw=; b=EBSjoNiTm/oN1/XPrmMNPSl9cUIe3xeHSSpNaH2W7cO8kPwm2phbrnzr2kLCwhQwt8p+bH u2WsUwPeFbeo0JZtgcAH/KIsrdjza+GyOlsmEKyPQu2Pz4AiyPhxDUGC6axNvMQXD08ifg DzyL/eLsRRqgBaExE/OlrN6kGGhD9CY= X-MC-Unique: bn6veVj0MBGvet_gRywybA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/14] conf: Use virTristateXXX in virDomainChrSourceDef Date: Wed, 7 Apr 2021 13:48:34 +0200 Message-Id: <20210407114841.85009-8-twiederh@redhat.com> In-Reply-To: <20210407114841.85009-1-twiederh@redhat.com> References: <20210407114841.85009-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.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 --- src/conf/domain_conf.c | 34 +++++++++++++++++++++------------- src/conf/domain_conf.h | 6 +++--- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e529eb7bc1..2ae3080a8c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11901,12 +11901,14 @@ virDomainChrSourceDefParseTCP(virDomainChrSourceD= efPtr def, def->data.tcp.service =3D virXMLPropString(source, "service"); =20 if ((tmp =3D virXMLPropString(source, "tls"))) { - if ((def->data.tcp.haveTLS =3D virTristateBoolTypeFromString(tmp))= <=3D 0) { + int value; + if ((value =3D virTristateBoolTypeFromString(tmp)) <=3D 0) { virReportError(VIR_ERR_XML_ERROR, _("unknown chardev 'tls' setting '%s'"), tmp); return -1; } + def->data.tcp.haveTLS =3D value; VIR_FREE(tmp); } =20 @@ -11985,12 +11987,15 @@ virDomainChrSourceDefParseFile(virDomainChrSource= DefPtr def, =20 def->data.file.path =3D virXMLPropString(source, "path"); =20 - if ((append =3D virXMLPropString(source, "append")) && - (def->data.file.append =3D virTristateSwitchTypeFromString(append)= ) <=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid append attribute value '%s'"), - append); - return -1; + if ((append =3D virXMLPropString(source, "append"))) { + int value; + if ((value =3D virTristateSwitchTypeFromString(append)) <=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid append attribute value '%s'"), + append); + return -1; + } + def->data.file.append =3D value; } =20 return 0; @@ -12026,12 +12031,15 @@ virDomainChrSourceDefParseLog(virDomainChrSourceD= efPtr def, =20 def->logfile =3D virXMLPropString(log, "file"); =20 - if ((append =3D virXMLPropString(log, "append")) && - (def->logappend =3D virTristateSwitchTypeFromString(append)) <=3D = 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid append attribute value '%s'"), - append); - return -1; + if ((append =3D virXMLPropString(log, "append"))) { + int value; + if ((value =3D virTristateSwitchTypeFromString(append)) <=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid append attribute value '%s'"), + append); + return -1; + } + def->logappend =3D value; } =20 return 0; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0c3d74095e..ad9b8f632b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1233,7 +1233,7 @@ struct _virDomainChrSourceDef { /* no for null, vc, stdio */ struct { char *path; - int append; /* enum virTristateSwitch */ + virTristateSwitch append; } file; /* pty, file, pipe, or device */ struct { char *master; @@ -1245,7 +1245,7 @@ struct _virDomainChrSourceDef { bool listen; int protocol; bool tlscreds; - int haveTLS; /* enum virTristateBool */ + virTristateBool haveTLS; bool tlsFromConfig; virDomainChrSourceReconnectDef reconnect; } tcp; @@ -1266,7 +1266,7 @@ struct _virDomainChrSourceDef { } spiceport; } data; char *logfile; - int logappend; + virTristateSwitch logappend; =20 size_t nseclabels; virSecurityDeviceLabelDefPtr *seclabels; --=20 2.26.2