From nobody Mon Feb 9 03:48:10 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=1618587610; cv=none; d=zohomail.com; s=zohoarc; b=bemWTqnhNMLAvkI0GaUAMnEIe58Yf6cGgjkkRMvX2e3lfYeQ5Z5Tooj3SLOs9Ci3YtdaFLElFUITBg0XEIJcwi/naNpibaS2K9e7uGWPlBB2ltV8EEH4aXGf4cQmBlNkkbLewv1TjYgqgIV6piQVeL4ZvGk9YAaz4OYr5jc/lTU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618587610; 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=q7I8DT9o4s6nHb991i937iy1jJKO6TGuSrlQJyJzHdA=; b=Nsps56IDT82o8L5xs1AaYatXvcxowo2D3zuzz/BADaMcselJKHZi9vevh0uGsSmK3psKol8KYTTFySUTVUyhn4JX6HLh1GzZvk+JZyXmzGB1DIgt84K+GfGUd2RvZ3V9CJoYadUEG35TiHL5iKzF6wX5vlxr1R0QEFyVA56hwe4= 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 1618587610510916.6875498409906; Fri, 16 Apr 2021 08:40:10 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-586-eTG5AQpRMXKnMKJbcu6pEA-1; Fri, 16 Apr 2021 11:39:40 -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 A4CDA1008065; Fri, 16 Apr 2021 15:39:35 +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 86DD86E6F5; Fri, 16 Apr 2021 15:39:35 +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 4A41444A6B; Fri, 16 Apr 2021 15:39:35 +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 13GFZK3U009461 for ; Fri, 16 Apr 2021 11:35:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 447C15C260; Fri, 16 Apr 2021 15:35:20 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id A54775C257 for ; Fri, 16 Apr 2021 15:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618587609; 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=q7I8DT9o4s6nHb991i937iy1jJKO6TGuSrlQJyJzHdA=; b=J9TRfvrfjIUX/ADAtab4mwayo4B2r9zNFhIT+LtYnRl6vTo5qvYClrILg+CE7eS8fbrziw eLExof9enpT89aJ+LaQkM4CdiiCNrqMLCeC6N7sFI+VH/bFifK06NIyIRyFjJKPTWoD/0Y bzdYDkyj6aJdj2cutN1o/adqu2wQUto= X-MC-Unique: eTG5AQpRMXKnMKJbcu6pEA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 22/25] conf: domain: Convert virDomainDiskDef's 'snapshot' to unsigned int Date: Fri, 16 Apr 2021 17:34:40 +0200 Message-Id: <4f1b31d92b0d01f9aa838353df13ef094a5b4f7b.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.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" Unfortunately virDomainSnapshotLocation is declared in snapshot_conf.h which includes domain_conf.h. To avoid a circular dependency use 'unsigned int' for now. Use XML parser can use virXMLPropEnum. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 15 +++------------ src/conf/domain_conf.h | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index da0e7700ff..6f7948da0a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9313,7 +9313,6 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, VIR_XPATH_NODE_AUTORESTORE(ctxt) bool source =3D false; g_autofree char *tmp =3D NULL; - g_autofree char *snapshot =3D NULL; g_autofree char *target =3D NULL; g_autofree char *bus =3D NULL; g_autofree char *serial =3D NULL; @@ -9349,7 +9348,9 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, VIR_XML_PROP_OPTIONAL, &def->model) < 0) return NULL; - snapshot =3D virXMLPropString(node, "snapshot"); + if (virXMLPropEnum(node, "snapshot", virDomainSnapshotLocationTypeFrom= String, + VIR_XML_PROP_OPTIONAL | VIR_XML_PROP_NONZERO, &def-= >snapshot) < 0) + return NULL; if (virXMLPropTristateBool(node, "rawio", VIR_XML_PROP_OPTIONAL, &def-= >rawio) < 0) return NULL; @@ -9461,16 +9462,6 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, } } - if (snapshot) { - def->snapshot =3D virDomainSnapshotLocationTypeFromString(snapshot= ); - if (def->snapshot <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk snapshot setting '%s'"), - snapshot); - 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 a83d5b337f..17d830a822 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -573,7 +573,7 @@ struct _virDomainDiskDef { virTristateSwitch ioeventfd; virTristateSwitch event_idx; virTristateSwitch copy_on_read; - int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */ + unsigned int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */ virDomainStartupPolicy startupPolicy; bool transient; virDomainDeviceInfo info; --=20 2.30.2