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)
/*
- * virdomainsnapshotobj.c: handle snapshot objects
+ * virdomainmomentobjlist.c: handle snapshot/checkpoint objects
* (derived from snapshot_conf.c)
*
* Copyright (C) 2006-2019 Red Hat, Inc.
#include <config.h>
#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
(curr->iter)(payload, name, curr->data);
curr->number += 1 + virDomainMomentForEachDescendant(obj,
- curr->iter,
- curr->data);
+ curr->iter,
+ curr->data);
return 0;
}
curr = moment->parent->first_child;
while (curr != moment) {
if (!curr) {
- VIR_WARN("inconsistent snapshot relations");
+ VIR_WARN("inconsistent moment relations");
return;
}
prev = curr;
/*
- * 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.
* <http://www.gnu.org/licenses/>.
*/
-#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);
void virDomainMomentSetParent(virDomainMomentObjPtr moment,
virDomainMomentObjPtr parent);
-#endif /* LIBVIRT_VIRDOMAINSNAPSHOTOBJ_H */
+#endif /* LIBVIRT_VIRDOMAINMOMENTOBJLIST_H */
# 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 */
virChrdevOpen;
+# conf/virdomainmomentobjlist.h
+virDomainMomentDropChildren;
+virDomainMomentDropParent;
+virDomainMomentForEachChild;
+virDomainMomentForEachDescendant;
+virDomainMomentMoveChildren;
+virDomainMomentSetParent;
+
+
# conf/virdomainobjlist.h
virDomainObjListAdd;
virDomainObjListCollect;
virDomainObjListRename;
-# conf/virdomainsnapshotobj.h
-virDomainMomentDropChildren;
-virDomainMomentDropParent;
-virDomainMomentForEachChild;
-virDomainMomentForEachDescendant;
-virDomainMomentMoveChildren;
-virDomainMomentSetParent;
-
-
# conf/virdomainsnapshotobjlist.h
virDomainListSnapshots;
virDomainSnapshotAssignDef;