From nobody Mon Feb 9 12:11:38 2026 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=1618587620; cv=none; d=zohomail.com; s=zohoarc; b=kU+tI2FbYiGzFFOKnuzo4ltGgUFrwQtOa47tQRhoP0bA0fjK9WTCdC0wd3aZglxof5ftJBLlgDyIKHShbh5woNme2q2Hfq4TQVCqMPXO0e8h5ERNLgkUbGxGtL1UzP3oVxBBKq4F22lyRQvpLuz2u3LdVYD7k4wyuagnuERUnQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618587620; 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=G6hQqGRAsr6UNAVCaqrVJiN+sYbyW12S7xz2+bxrwoA=; b=l4uRsYwgFNWJK986m82uDAcrvPcKV6CeKpjJ+p5QKVkTvXi7NUQybWKqGy91euvocXj/VwjnL3IjvYspMNXPCCK8N0S/Rq36r6QBiQv5Neng7iKvUJIXtqyRjWTA43hm/ern5xtUnZR43o9DeJyeG7QDdvs/zvWYvHlawV1PmAE= 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 1618587620387151.5204301588425; Fri, 16 Apr 2021 08:40:20 -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-222-Vlj9FBxBNcqz4SPJIyXgcQ-1; Fri, 16 Apr 2021 11:38:51 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 41DAA10054F6; Fri, 16 Apr 2021 15:38: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 11E34107D5C2; Fri, 16 Apr 2021 15:38:43 +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 CB10344A5F; Fri, 16 Apr 2021 15:38:42 +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 13GFZIDl009437 for ; Fri, 16 Apr 2021 11:35:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2A4215C260; Fri, 16 Apr 2021 15:35:18 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B0605C257 for ; Fri, 16 Apr 2021 15:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618587619; 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=G6hQqGRAsr6UNAVCaqrVJiN+sYbyW12S7xz2+bxrwoA=; b=UvxfxvuLhFZoW5y7w5W++LnrJYzNMV58JWjQqiwV294fWIlh2PLwSSCulk+T5KHPi4WrzI zbSP6PqVUWx41Zpz1FgQkOO4g8y0SrpNOPZwf8WlGcJq5z4cImg5m0WpF3SPgbWNms+wJS yohNAMz/4TzOeGrz/bx4RBhyCYgT310= X-MC-Unique: Vlj9FBxBNcqz4SPJIyXgcQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 20/25] conf: domain: Convert virDomainDiskDef's 'sgio' to virDomainDeviceSGIO Date: Fri, 16 Apr 2021 17:34:38 +0200 Message-Id: <588ffe4f5b82c7822f944251a07f21fb0bc629c0.1618587222.git.pkrempa@redhat.com> 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" 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 | 13 +++---------- src/conf/domain_conf.h | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6641a7a78b..fd933fefc8 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 *sgio =3D NULL; g_autofree char *target =3D NULL; g_autofree char *bus =3D NULL; g_autofree char *serial =3D NULL; @@ -9359,7 +9358,9 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, if (virXMLPropTristateBool(node, "rawio", VIR_XML_PROP_OPTIONAL, &def-= >rawio) < 0) return NULL; - sgio =3D virXMLPropString(node, "sgio"); + if (virXMLPropEnum(node, "sgio", virDomainDeviceSGIOTypeFromString, + VIR_XML_PROP_OPTIONAL | VIR_XML_PROP_NONZERO, &def-= >sgio) < 0) + return NULL; for (cur =3D node->children; cur !=3D NULL; cur =3D cur->next) { if (cur->type !=3D XML_ELEMENT_NODE) @@ -9474,14 +9475,6 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, } } - if (sgio) { - if ((def->sgio =3D virDomainDeviceSGIOTypeFromString(sgio)) <=3D 0= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk sgio mode '%s'"), sgio); - return NULL; - } - } - if (bus) { if ((def->bus =3D virDomainDiskBusTypeFromString(bus)) <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b3a91c0a4c..1b62af6d63 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -578,7 +578,7 @@ struct _virDomainDiskDef { bool transient; virDomainDeviceInfo info; virTristateBool rawio; - int sgio; /* enum virDomainDeviceSGIO */ + virDomainDeviceSGIO sgio; int discard; /* enum virDomainDiskDiscard */ unsigned int iothread; /* unused =3D 0, > 0 specific thread # */ int detect_zeroes; /* enum virDomainDiskDetectZeroes */ --=20 2.30.2