1 #ifndef LIBXL__SR_STREAM_FORMAT_H
2 #define LIBXL__SR_STREAM_FORMAT_H
3 
4 /*
5  * C structures for the Migration v2 stream format.
6  * See docs/specs/libxl-migration-stream.pandoc
7  */
8 
9 #include <stdint.h>
10 
11 typedef struct libxl__sr_hdr
12 {
13     uint64_t ident;
14     uint32_t version;
15     uint32_t options;
16 } libxl__sr_hdr;
17 
18 #define RESTORE_STREAM_IDENT         0x4c6962786c466d74UL
19 #define RESTORE_STREAM_VERSION       0x00000002U
20 
21 #define RESTORE_OPT_BIG_ENDIAN       (1u << 0)
22 #define RESTORE_OPT_LEGACY           (1u << 1)
23 
24 
25 typedef struct libxl__sr_rec_hdr
26 {
27     uint32_t type;
28     uint32_t length;
29 } libxl__sr_rec_hdr;
30 
31 /* All records must be aligned up to an 8 octet boundary */
32 #define REC_ALIGN_ORDER              3U
33 
34 #define REC_TYPE_END                    0x00000000U
35 #define REC_TYPE_LIBXC_CONTEXT          0x00000001U
36 #define REC_TYPE_EMULATOR_XENSTORE_DATA 0x00000002U
37 #define REC_TYPE_EMULATOR_CONTEXT       0x00000003U
38 #define REC_TYPE_CHECKPOINT_END         0x00000004U
39 #define REC_TYPE_CHECKPOINT_STATE       0x00000005U
40 
41 typedef struct libxl__sr_emulator_hdr
42 {
43     uint32_t id;
44     uint32_t index;
45 } libxl__sr_emulator_hdr;
46 
47 #define EMULATOR_UNKNOWN             0x00000000U
48 #define EMULATOR_QEMU_TRADITIONAL    0x00000001U
49 #define EMULATOR_QEMU_UPSTREAM       0x00000002U
50 
51 typedef struct libxl_sr_checkpoint_state
52 {
53     uint32_t id;
54 } libxl_sr_checkpoint_state;
55 
56 #define CHECKPOINT_NEW               0x00000000U
57 #define CHECKPOINT_SVM_SUSPENDED     0x00000001U
58 #define CHECKPOINT_SVM_READY         0x00000002U
59 #define CHECKPOINT_SVM_RESUMED       0x00000003U
60 
61 #endif /* LIBXL__SR_STREAM_FORMAT_H */
62 
63 /*
64  * Local variables:
65  * mode: C
66  * c-basic-offset: 4
67  * indent-tabs-mode: nil
68  * End:
69  */
70