1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#ifndef SNAPSHOT_H
26#define SNAPSHOT_H
27
28#include "qapi/qapi-builtin-types.h"
29
30#define SNAPSHOT_OPT_BASE "snapshot."
31#define SNAPSHOT_OPT_ID "snapshot.id"
32#define SNAPSHOT_OPT_NAME "snapshot.name"
33
34extern QemuOptsList internal_snapshot_opts;
35
36typedef struct QEMUSnapshotInfo {
37 char id_str[128];
38
39
40 char name[256];
41 uint64_t vm_state_size;
42 uint32_t date_sec;
43 uint32_t date_nsec;
44 uint64_t vm_clock_nsec;
45 uint64_t icount;
46} QEMUSnapshotInfo;
47
48
49
50
51
52
53
54
55int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info,
56 const char *name);
57bool bdrv_snapshot_find_by_id_and_name(BlockDriverState *bs,
58 const char *id,
59 const char *name,
60 QEMUSnapshotInfo *sn_info,
61 Error **errp);
62int bdrv_can_snapshot(BlockDriverState *bs);
63int bdrv_snapshot_create(BlockDriverState *bs,
64 QEMUSnapshotInfo *sn_info);
65int bdrv_snapshot_goto(BlockDriverState *bs,
66 const char *snapshot_id,
67 Error **errp);
68int bdrv_snapshot_delete(BlockDriverState *bs,
69 const char *snapshot_id,
70 const char *name,
71 Error **errp);
72int bdrv_snapshot_list(BlockDriverState *bs,
73 QEMUSnapshotInfo **psn_info);
74int bdrv_snapshot_load_tmp(BlockDriverState *bs,
75 const char *snapshot_id,
76 const char *name,
77 Error **errp);
78int bdrv_snapshot_load_tmp_by_id_or_name(BlockDriverState *bs,
79 const char *id_or_name,
80 Error **errp);
81
82
83
84
85
86
87
88
89bool bdrv_all_can_snapshot(bool has_devices, strList *devices,
90 Error **errp);
91int bdrv_all_delete_snapshot(const char *name,
92 bool has_devices, strList *devices,
93 Error **errp);
94int bdrv_all_goto_snapshot(const char *name,
95 bool has_devices, strList *devices,
96 Error **errp);
97int bdrv_all_has_snapshot(const char *name,
98 bool has_devices, strList *devices,
99 Error **errp);
100int bdrv_all_create_snapshot(QEMUSnapshotInfo *sn,
101 BlockDriverState *vm_state_bs,
102 uint64_t vm_state_size,
103 bool has_devices,
104 strList *devices,
105 Error **errp);
106
107BlockDriverState *bdrv_all_find_vmstate_bs(const char *vmstate_bs,
108 bool has_devices, strList *devices,
109 Error **errp);
110
111#endif
112