From nobody Mon Feb 9 01:00:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1618587533; cv=none; d=zohomail.com; s=zohoarc; b=g/fzH1Ax5HLXczsO0CNS6aR38CX/Bbbgr54Yq2+z0BVUB2BtVFicjY8yYGc5J13uIwlW4YzK1ceGOFSahdy1B2FmlFZL9n/I7b/N8OXVge1avRmiADo65eFamp45bDeS5rl6yvIMci8KlaVVHcTY2duLXDpzWHNbiQrvs90Ay2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618587533; h=Content-Type:Content-Transfer-Encoding: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=I6tm1IgHjnue+Hrco3UsIs/Qn3v2rrXaMFfKsrLFH+M=; b=BSxerbjopP0yYXoQpMHL49yQ60ujRWIif+EgBJSw6/9z/XaEfXvHc82JLkprBGtxFisLYF8ULRUB7Re/5X6WKEjfnyg+wtz3EXVs/xcJNf6dunvK1zTTCTW9ufO3jW1YUUnICtzd9ej0MM0f+nh1+rdkWjtEXpmGc3OPqcEh/fM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1618587533457718.5857706577186; Fri, 16 Apr 2021 08:38: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-578-PVwASzXVN_e_d-RKfjSwVg-1; Fri, 16 Apr 2021 11:38: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 7EAC3107ACF4; Fri, 16 Apr 2021 15:38:40 +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 6200D60861; Fri, 16 Apr 2021 15:38:40 +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 3270A1809C82; Fri, 16 Apr 2021 15:38:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GFZHoR009428 for ; Fri, 16 Apr 2021 11:35:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1F7835C257; Fri, 16 Apr 2021 15:35:17 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D6BC5C260 for ; Fri, 16 Apr 2021 15:35:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618587532; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=I6tm1IgHjnue+Hrco3UsIs/Qn3v2rrXaMFfKsrLFH+M=; b=MBIbFFdpgIDurHqTNJ5SA2EP8S8JD7KtipfL8aQj/GkKihoBVXqc7In+3bsFf/quF0F3QD gDCftS9eq3se1ADFEtkftbA0+RS5YHLPeNBJZwfq34jmIPQA1MTCNLUUZbfeWQwF0wEwRy zS2E9WxeWAcDHGZMNVVJWamNfsMRYFI= X-MC-Unique: PVwASzXVN_e_d-RKfjSwVg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 19/25] conf: domain: Convert virDomainDiskDef's 'rawio' to virTristateBool Date: Fri, 16 Apr 2021 17:34:37 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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" Use the appropriate type for the variable and refactor the XML parser to parse it correctly using virXMLPropEnum. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 14 +++----------- src/conf/domain_conf.h | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5e27ca6265..6641a7a78b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9314,7 +9314,6 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, bool source =3D false; g_autofree char *tmp =3D NULL; g_autofree char *snapshot =3D NULL; - g_autofree char *rawio =3D NULL; g_autofree char *sgio =3D NULL; g_autofree char *target =3D NULL; g_autofree char *bus =3D NULL; @@ -9357,7 +9356,9 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, snapshot =3D virXMLPropString(node, "snapshot"); - rawio =3D virXMLPropString(node, "rawio"); + if (virXMLPropTristateBool(node, "rawio", VIR_XML_PROP_OPTIONAL, &def-= >rawio) < 0) + return NULL; + sgio =3D virXMLPropString(node, "sgio"); for (cur =3D node->children; cur !=3D NULL; cur =3D cur->next) { @@ -9473,15 +9474,6 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, } } - if (rawio) { - if ((def->rawio =3D virTristateBoolTypeFromString(rawio)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("unknown disk rawio setting '%s'"), - rawio); - return NULL; - } - } - if (sgio) { if ((def->sgio =3D virDomainDeviceSGIOTypeFromString(sgio)) <=3D 0= ) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 878ba4c961..b3a91c0a4c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -577,7 +577,7 @@ struct _virDomainDiskDef { virDomainStartupPolicy startupPolicy; bool transient; virDomainDeviceInfo info; - int rawio; /* enum virTristateBool */ + virTristateBool rawio; int sgio; /* enum virDomainDeviceSGIO */ int discard; /* enum virDomainDiskDiscard */ unsigned int iothread; /* unused =3D 0, > 0 specific thread # */ --=20 2.30.2