1 /*
2  * virdomaincheckpointobjlist.h: handle a tree of checkpoint objects
3  *                  (derived from virdomainsnapshotobjlist.h)
4  *
5  * Copyright (C) 2006-2019 Red Hat, Inc.
6  * Copyright (C) 2006-2008 Daniel P. Berrange
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library.  If not, see
20  * <http://www.gnu.org/licenses/>.
21  */
22 
23 #pragma once
24 
25 #include "internal.h"
26 #include "virdomainmomentobjlist.h"
27 #include "virbuffer.h"
28 
29 virDomainCheckpointObjList *
30 virDomainCheckpointObjListNew(void);
31 
32 void
33 virDomainCheckpointObjListFree(virDomainCheckpointObjList *checkpoints);
34 
35 virDomainMomentObj *
36 virDomainCheckpointAssignDef(virDomainCheckpointObjList *checkpoints,
37                              virDomainCheckpointDef *def);
38 
39 virDomainMomentObj *
40 virDomainCheckpointFindByName(virDomainCheckpointObjList *checkpoints,
41                               const char *name);
42 
43 virDomainMomentObj *
44 virDomainCheckpointGetCurrent(virDomainCheckpointObjList *checkpoints);
45 
46 const char *
47 virDomainCheckpointGetCurrentName(virDomainCheckpointObjList *checkpoints);
48 
49 void
50 virDomainCheckpointSetCurrent(virDomainCheckpointObjList *checkpoints,
51                               virDomainMomentObj *checkpoint);
52 
53 bool
54 virDomainCheckpointObjListRemove(virDomainCheckpointObjList *checkpoints,
55                                  virDomainMomentObj *checkpoint);
56 
57 void
58 virDomainCheckpointObjListRemoveAll(virDomainCheckpointObjList *checkpoints);
59 
60 int
61 virDomainCheckpointForEach(virDomainCheckpointObjList *checkpoints,
62                            virHashIterator iter,
63                            void *data);
64 
65 void
66 virDomainCheckpointLinkParent(virDomainCheckpointObjList *checkpoints,
67                               virDomainMomentObj *chk);
68 
69 int
70 virDomainCheckpointUpdateRelations(virDomainCheckpointObjList *checkpoints,
71                                    virDomainMomentObj **leaf);
72 
73 int
74 virDomainCheckpointCheckCycles(virDomainCheckpointObjList *checkpoints,
75                                virDomainCheckpointDef *def,
76                                const char *domname);
77 
78 #define VIR_DOMAIN_CHECKPOINT_FILTERS_LEAVES \
79                (VIR_DOMAIN_CHECKPOINT_LIST_LEAVES       | \
80                 VIR_DOMAIN_CHECKPOINT_LIST_NO_LEAVES)
81 
82 #define VIR_DOMAIN_CHECKPOINT_FILTERS_ALL \
83                (VIR_DOMAIN_CHECKPOINT_FILTERS_LEAVES)
84 
85 int
86 virDomainListCheckpoints(virDomainCheckpointObjList *checkpoints,
87                          virDomainMomentObj *from,
88                          virDomainPtr dom,
89                          virDomainCheckpointPtr **objs,
90                          unsigned int flags);
91 
92 static inline virDomainCheckpointDef *
virDomainCheckpointObjGetDef(virDomainMomentObj * obj)93 virDomainCheckpointObjGetDef(virDomainMomentObj *obj)
94 {
95     return (virDomainCheckpointDef *) obj->def;
96 }
97