From nobody Mon Feb 9 08:55:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1553060498694566.9790176710407; Tue, 19 Mar 2019 22:41:38 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 0E38E3084028; Wed, 20 Mar 2019 05:41:37 +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 D9EDA18E59; Wed, 20 Mar 2019 05:41: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 94D91181A000; Wed, 20 Mar 2019 05:41:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2K5fWjK017285 for ; Wed, 20 Mar 2019 01:41:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3093C1974C; Wed, 20 Mar 2019 05:41:32 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-65.phx2.redhat.com [10.3.116.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id C201417795; Wed, 20 Mar 2019 05:41:31 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Wed, 20 Mar 2019 00:41:02 -0500 Message-Id: <20190320054105.17689-14-eblake@redhat.com> In-Reply-To: <20190320054105.17689-1-eblake@redhat.com> References: <20190320054105.17689-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com Subject: [libvirt] [PATCH 13/16] snapshot: Rename file for virDomainMomentObj 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 20 Mar 2019 05:41:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now that we have made virDomainMomentObj sufficiently generic to support both snapshots and checkpoints, it is time to rename the file that it lives in. The split between a generic object and a list of the generic objects doesn't buy us as much, so it will be easier to stick all the moment list code in one file, with more code moving in the next patch. Signed-off-by: Eric Blake Reviewed-by: John Ferlan --- ...snapshotobj.h =3D> virdomainmomentobjlist.h} | 26 ++++++++++--------- src/conf/virdomainsnapshotobjlist.h | 7 ++++- src/conf/Makefile.inc.am | 4 +-- ...snapshotobj.c =3D> virdomainmomentobjlist.c} | 12 ++++----- src/libvirt_private.syms | 18 ++++++------- 5 files changed, 37 insertions(+), 30 deletions(-) rename src/conf/{virdomainsnapshotobj.h =3D> virdomainmomentobjlist.h} (72= %) rename src/conf/{virdomainsnapshotobj.c =3D> virdomainmomentobjlist.c} (95= %) diff --git a/src/conf/virdomainsnapshotobj.h b/src/conf/virdomainmomentobjl= ist.h similarity index 72% rename from src/conf/virdomainsnapshotobj.h rename to src/conf/virdomainmomentobjlist.h index 86c5f6860b..dceb55fca2 100644 --- a/src/conf/virdomainsnapshotobj.h +++ b/src/conf/virdomainmomentobjlist.h @@ -1,5 +1,5 @@ /* - * virdomainsnapshotobj.h: handle snapshot objects + * virdomainmomentobjlist.h: handle a tree of moment objects * (derived from snapshot_conf.h) * * Copyright (C) 2006-2019 Red Hat, Inc. @@ -20,25 +20,33 @@ * . */ -#ifndef LIBVIRT_VIRDOMAINSNAPSHOTOBJ_H -# define LIBVIRT_VIRDOMAINSNAPSHOTOBJ_H +#ifndef LIBVIRT_VIRDOMAINMOMENTOBJLIST_H +# define LIBVIRT_VIRDOMAINMOMENTOBJLIST_H # include "internal.h" # include "virconftypes.h" # include "virhash.h" +/* Struct that allows tracing hierarchical relationships between + * multiple virDomainMoment objects. The opaque type + * virDomainMomentObjList then maintains both a hash of these structs + * (for quick lookup by name) and a metaroot (which is the parent of + * all user-visible roots), so that all other objects always have a + * valid parent object; the tree structure is currently maintained via + * a linked list. */ struct _virDomainMomentObj { + /* Public field */ virDomainMomentDefPtr def; /* non-NULL except for metaroot */ + /* Private fields, use accessors instead */ virDomainMomentObjPtr parent; /* non-NULL except for metaroot, before - virDomainSnapshotUpdateRelations, or + virDomainMomentUpdateRelations, or after virDomainMomentDropParent */ virDomainMomentObjPtr sibling; /* NULL if last child of parent */ size_t nchildren; virDomainMomentObjPtr first_child; /* NULL if no children */ }; - int virDomainMomentForEachChild(virDomainMomentObjPtr moment, virHashIterator iter, void *data); @@ -52,10 +60,4 @@ void virDomainMomentMoveChildren(virDomainMomentObjPtr f= rom, void virDomainMomentSetParent(virDomainMomentObjPtr moment, virDomainMomentObjPtr parent); -static inline virDomainSnapshotDefPtr -virDomainSnapshotObjGetDef(virDomainMomentObjPtr obj) -{ - return (virDomainSnapshotDefPtr) obj->def; -} - -#endif /* LIBVIRT_VIRDOMAINSNAPSHOTOBJ_H */ +#endif /* LIBVIRT_VIRDOMAINMOMENTOBJLIST_H */ diff --git a/src/conf/virdomainsnapshotobjlist.h b/src/conf/virdomainsnapsh= otobjlist.h index 1af367639d..c36b498751 100644 --- a/src/conf/virdomainsnapshotobjlist.h +++ b/src/conf/virdomainsnapshotobjlist.h @@ -24,7 +24,7 @@ # define LIBVIRT_VIRDOMAINSNAPSHOTOBJLIST_H # include "internal.h" -# include "virdomainsnapshotobj.h" +# include "virdomainmomentobjlist.h" # include "virbuffer.h" /* Filter that returns true if a given moment matches the filter flags */ @@ -80,4 +80,9 @@ int virDomainListSnapshots(virDomainSnapshotObjListPtr sn= apshots, virDomainSnapshotPtr **snaps, unsigned int flags); +static inline virDomainSnapshotDefPtr +virDomainSnapshotObjGetDef(virDomainMomentObjPtr obj) +{ + return (virDomainSnapshotDefPtr) obj->def; +} #endif /* LIBVIRT_VIRDOMAINSNAPSHOTOBJLIST_H */ diff --git a/src/conf/Makefile.inc.am b/src/conf/Makefile.inc.am index d2ff8be8fd..6eb64db9de 100644 --- a/src/conf/Makefile.inc.am +++ b/src/conf/Makefile.inc.am @@ -31,8 +31,8 @@ DOMAIN_CONF_SOURCES =3D \ conf/virconftypes.h \ conf/virdomainobjlist.c \ conf/virdomainobjlist.h \ - conf/virdomainsnapshotobj.c \ - conf/virdomainsnapshotobj.h \ + conf/virdomainmomentobjlist.c \ + conf/virdomainmomentobjlist.h \ conf/virdomainsnapshotobjlist.c \ conf/virdomainsnapshotobjlist.h \ $(NULL) diff --git a/src/conf/virdomainsnapshotobj.c b/src/conf/virdomainmomentobjl= ist.c similarity index 95% rename from src/conf/virdomainsnapshotobj.c rename to src/conf/virdomainmomentobjlist.c index 877a0a9079..766d7fe2e4 100644 --- a/src/conf/virdomainsnapshotobj.c +++ b/src/conf/virdomainmomentobjlist.c @@ -1,5 +1,5 @@ /* - * virdomainsnapshotobj.c: handle snapshot objects + * virdomainmomentobjlist.c: handle snapshot/checkpoint objects * (derived from snapshot_conf.c) * * Copyright (C) 2006-2019 Red Hat, Inc. @@ -23,15 +23,15 @@ #include #include "internal.h" -#include "virdomainsnapshotobj.h" -#include "snapshot_conf.h" -#include "virdomainsnapshotobjlist.h" +#include "virdomainmomentobjlist.h" #include "virlog.h" #include "virerror.h" +#include "virstring.h" +#include "moment_conf.h" -#define VIR_FROM_THIS VIR_FROM_DOMAIN_SNAPSHOT +#define VIR_FROM_THIS VIR_FROM_DOMAIN -VIR_LOG_INIT("conf.virdomainsnapshotobj"); +VIR_LOG_INIT("conf.virdomainmomentobjlist"); /* Run iter(data) on all direct children of moment, while ignoring all * other entries in moments. Return the number of children diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 02f383fdba..10cdfad4fd 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -960,6 +960,15 @@ virChrdevFree; virChrdevOpen; +# conf/virdomainmomentobjlist.h +virDomainMomentDropChildren; +virDomainMomentDropParent; +virDomainMomentForEachChild; +virDomainMomentForEachDescendant; +virDomainMomentMoveChildren; +virDomainMomentSetParent; + + # conf/virdomainobjlist.h virDomainObjListAdd; virDomainObjListCollect; @@ -979,15 +988,6 @@ virDomainObjListRemoveLocked; virDomainObjListRename; -# conf/virdomainsnapshotobj.h -virDomainMomentDropChildren; -virDomainMomentDropParent; -virDomainMomentForEachChild; -virDomainMomentForEachDescendant; -virDomainMomentMoveChildren; -virDomainMomentSetParent; - - # conf/virdomainsnapshotobjlist.h virDomainListSnapshots; virDomainSnapshotAssignDef; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list