2 * QEMU migration/snapshot declarations
4 * Copyright (c) 2009-2011 Red Hat, Inc.
6 * Original author: Juan Quintela <quintela@redhat.com>
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 #ifndef QEMU_VMSTATE_H
27 #define QEMU_VMSTATE_H 1
29 typedef void SaveStateHandler(QEMUFile
*f
, void *opaque
);
30 typedef int LoadStateHandler(QEMUFile
*f
, void *opaque
, int version_id
);
32 typedef struct SaveVMHandlers
{
33 void (*set_params
)(const MigrationParams
*params
, void * opaque
);
34 SaveStateHandler
*save_state
;
35 int (*save_live_state
)(QEMUFile
*f
, int stage
, void *opaque
);
36 void (*cancel
)(void *opaque
);
37 LoadStateHandler
*load_state
;
38 bool (*is_active
)(void *opaque
);
41 int register_savevm(DeviceState
*dev
,
45 SaveStateHandler
*save_state
,
46 LoadStateHandler
*load_state
,
49 int register_savevm_live(DeviceState
*dev
,
56 void unregister_savevm(DeviceState
*dev
, const char *idstr
, void *opaque
);
57 void register_device_unmigratable(DeviceState
*dev
, const char *idstr
,
61 typedef struct VMStateInfo VMStateInfo
;
62 typedef struct VMStateDescription VMStateDescription
;
66 int (*get
)(QEMUFile
*f
, void *pv
, size_t size
);
67 void (*put
)(QEMUFile
*f
, void *pv
, size_t size
);
75 VMS_VARRAY_INT32
= 0x010, /* Array with size in int32_t field*/
76 VMS_BUFFER
= 0x020, /* static sized buffer */
77 VMS_ARRAY_OF_POINTER
= 0x040,
78 VMS_VARRAY_UINT16
= 0x080, /* Array with size in uint16_t field */
79 VMS_VBUFFER
= 0x100, /* Buffer with size in int32_t field */
80 VMS_MULTIPLY
= 0x200, /* multiply "size" field by field_size */
81 VMS_VARRAY_UINT8
= 0x400, /* Array with size in uint8_t field*/
82 VMS_VARRAY_UINT32
= 0x800, /* Array with size in uint32_t field*/
93 const VMStateInfo
*info
;
94 enum VMStateFlags flags
;
95 const VMStateDescription
*vmsd
;
97 bool (*field_exists
)(void *opaque
, int version_id
);
100 typedef struct VMStateSubsection
{
101 const VMStateDescription
*vmsd
;
102 bool (*needed
)(void *opaque
);
105 struct VMStateDescription
{
109 int minimum_version_id
;
110 int minimum_version_id_old
;
111 LoadStateHandler
*load_state_old
;
112 int (*pre_load
)(void *opaque
);
113 int (*post_load
)(void *opaque
, int version_id
);
114 void (*pre_save
)(void *opaque
);
115 VMStateField
*fields
;
116 const VMStateSubsection
*subsections
;
119 extern const VMStateInfo vmstate_info_bool
;
121 extern const VMStateInfo vmstate_info_int8
;
122 extern const VMStateInfo vmstate_info_int16
;
123 extern const VMStateInfo vmstate_info_int32
;
124 extern const VMStateInfo vmstate_info_int64
;
126 extern const VMStateInfo vmstate_info_uint8_equal
;
127 extern const VMStateInfo vmstate_info_uint16_equal
;
128 extern const VMStateInfo vmstate_info_int32_equal
;
129 extern const VMStateInfo vmstate_info_uint32_equal
;
130 extern const VMStateInfo vmstate_info_int32_le
;
132 extern const VMStateInfo vmstate_info_uint8
;
133 extern const VMStateInfo vmstate_info_uint16
;
134 extern const VMStateInfo vmstate_info_uint32
;
135 extern const VMStateInfo vmstate_info_uint64
;
137 extern const VMStateInfo vmstate_info_timer
;
138 extern const VMStateInfo vmstate_info_buffer
;
139 extern const VMStateInfo vmstate_info_unused_buffer
;
141 #define type_check_array(t1,t2,n) ((t1(*)[n])0 - (t2*)0)
142 #define type_check_pointer(t1,t2) ((t1**)0 - (t2*)0)
144 #define vmstate_offset_value(_state, _field, _type) \
145 (offsetof(_state, _field) + \
146 type_check(_type, typeof_field(_state, _field)))
148 #define vmstate_offset_pointer(_state, _field, _type) \
149 (offsetof(_state, _field) + \
150 type_check_pointer(_type, typeof_field(_state, _field)))
152 #define vmstate_offset_array(_state, _field, _type, _num) \
153 (offsetof(_state, _field) + \
154 type_check_array(_type, typeof_field(_state, _field), _num))
156 #define vmstate_offset_sub_array(_state, _field, _type, _start) \
157 (offsetof(_state, _field[_start]))
159 #define vmstate_offset_buffer(_state, _field) \
160 vmstate_offset_array(_state, _field, uint8_t, \
161 sizeof(typeof_field(_state, _field)))
163 #define VMSTATE_SINGLE_TEST(_field, _state, _test, _version, _info, _type) { \
164 .name = (stringify(_field)), \
165 .version_id = (_version), \
166 .field_exists = (_test), \
167 .size = sizeof(_type), \
169 .flags = VMS_SINGLE, \
170 .offset = vmstate_offset_value(_state, _field, _type), \
173 #define VMSTATE_POINTER(_field, _state, _version, _info, _type) { \
174 .name = (stringify(_field)), \
175 .version_id = (_version), \
177 .size = sizeof(_type), \
178 .flags = VMS_SINGLE|VMS_POINTER, \
179 .offset = vmstate_offset_value(_state, _field, _type), \
182 #define VMSTATE_POINTER_TEST(_field, _state, _test, _info, _type) { \
183 .name = (stringify(_field)), \
185 .field_exists = (_test), \
186 .size = sizeof(_type), \
187 .flags = VMS_SINGLE|VMS_POINTER, \
188 .offset = vmstate_offset_value(_state, _field, _type), \
191 #define VMSTATE_ARRAY(_field, _state, _num, _version, _info, _type) {\
192 .name = (stringify(_field)), \
193 .version_id = (_version), \
196 .size = sizeof(_type), \
197 .flags = VMS_ARRAY, \
198 .offset = vmstate_offset_array(_state, _field, _type, _num), \
201 #define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\
202 .name = (stringify(_field)), \
203 .field_exists = (_test), \
206 .size = sizeof(_type), \
207 .flags = VMS_ARRAY, \
208 .offset = vmstate_offset_array(_state, _field, _type, _num),\
211 #define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _version, _info, _type) { \
212 .name = (stringify(_field)), \
213 .version_id = (_version), \
216 .size = sizeof(_type), \
217 .flags = VMS_ARRAY, \
218 .offset = vmstate_offset_sub_array(_state, _field, _type, _start), \
221 #define VMSTATE_ARRAY_INT32_UNSAFE(_field, _state, _field_num, _info, _type) {\
222 .name = (stringify(_field)), \
223 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
225 .size = sizeof(_type), \
226 .flags = VMS_VARRAY_INT32, \
227 .offset = offsetof(_state, _field), \
230 #define VMSTATE_VARRAY_INT32(_field, _state, _field_num, _version, _info, _type) {\
231 .name = (stringify(_field)), \
232 .version_id = (_version), \
233 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
235 .size = sizeof(_type), \
236 .flags = VMS_VARRAY_INT32|VMS_POINTER, \
237 .offset = vmstate_offset_pointer(_state, _field, _type), \
240 #define VMSTATE_VARRAY_UINT32(_field, _state, _field_num, _version, _info, _type) {\
241 .name = (stringify(_field)), \
242 .version_id = (_version), \
243 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
245 .size = sizeof(_type), \
246 .flags = VMS_VARRAY_UINT32|VMS_POINTER, \
247 .offset = vmstate_offset_pointer(_state, _field, _type), \
250 #define VMSTATE_VARRAY_UINT16_UNSAFE(_field, _state, _field_num, _version, _info, _type) {\
251 .name = (stringify(_field)), \
252 .version_id = (_version), \
253 .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
255 .size = sizeof(_type), \
256 .flags = VMS_VARRAY_UINT16, \
257 .offset = offsetof(_state, _field), \
260 #define VMSTATE_STRUCT_TEST(_field, _state, _test, _version, _vmsd, _type) { \
261 .name = (stringify(_field)), \
262 .version_id = (_version), \
263 .field_exists = (_test), \
265 .size = sizeof(_type), \
266 .flags = VMS_STRUCT, \
267 .offset = vmstate_offset_value(_state, _field, _type), \
270 #define VMSTATE_STRUCT_POINTER_TEST(_field, _state, _test, _vmsd, _type) { \
271 .name = (stringify(_field)), \
272 .field_exists = (_test), \
274 .size = sizeof(_type), \
275 .flags = VMS_STRUCT|VMS_POINTER, \
276 .offset = vmstate_offset_value(_state, _field, _type), \
279 #define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _version, _info, _type) {\
280 .name = (stringify(_field)), \
281 .version_id = (_version), \
284 .size = sizeof(_type), \
285 .flags = VMS_ARRAY|VMS_ARRAY_OF_POINTER, \
286 .offset = vmstate_offset_array(_state, _field, _type, _num), \
289 #define VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, _test, _version, _vmsd, _type) { \
290 .name = (stringify(_field)), \
292 .field_exists = (_test), \
293 .version_id = (_version), \
295 .size = sizeof(_type), \
296 .flags = VMS_STRUCT|VMS_ARRAY, \
297 .offset = vmstate_offset_array(_state, _field, _type, _num),\
300 #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
301 .name = (stringify(_field)), \
302 .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
303 .version_id = (_version), \
305 .size = sizeof(_type), \
306 .flags = VMS_STRUCT|VMS_VARRAY_UINT8, \
307 .offset = offsetof(_state, _field), \
310 #define VMSTATE_STRUCT_VARRAY_POINTER_INT32(_field, _state, _field_num, _vmsd, _type) { \
311 .name = (stringify(_field)), \
313 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
314 .size = sizeof(_type), \
316 .flags = VMS_POINTER | VMS_VARRAY_INT32 | VMS_STRUCT, \
317 .offset = vmstate_offset_pointer(_state, _field, _type), \
320 #define VMSTATE_STRUCT_VARRAY_POINTER_UINT16(_field, _state, _field_num, _vmsd, _type) { \
321 .name = (stringify(_field)), \
323 .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
324 .size = sizeof(_type), \
326 .flags = VMS_POINTER | VMS_VARRAY_UINT16 | VMS_STRUCT, \
327 .offset = vmstate_offset_pointer(_state, _field, _type), \
330 #define VMSTATE_STRUCT_VARRAY_INT32(_field, _state, _field_num, _version, _vmsd, _type) { \
331 .name = (stringify(_field)), \
332 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
333 .version_id = (_version), \
335 .size = sizeof(_type), \
336 .flags = VMS_STRUCT|VMS_VARRAY_INT32, \
337 .offset = offsetof(_state, _field), \
340 #define VMSTATE_STRUCT_VARRAY_UINT32(_field, _state, _field_num, _version, _vmsd, _type) { \
341 .name = (stringify(_field)), \
342 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t), \
343 .version_id = (_version), \
345 .size = sizeof(_type), \
346 .flags = VMS_STRUCT|VMS_VARRAY_UINT32, \
347 .offset = offsetof(_state, _field), \
350 #define VMSTATE_STATIC_BUFFER(_field, _state, _version, _test, _start, _size) { \
351 .name = (stringify(_field)), \
352 .version_id = (_version), \
353 .field_exists = (_test), \
354 .size = (_size - _start), \
355 .info = &vmstate_info_buffer, \
356 .flags = VMS_BUFFER, \
357 .offset = vmstate_offset_buffer(_state, _field) + _start, \
360 #define VMSTATE_BUFFER_MULTIPLY(_field, _state, _version, _test, _start, _field_size, _multiply) { \
361 .name = (stringify(_field)), \
362 .version_id = (_version), \
363 .field_exists = (_test), \
364 .size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
365 .size = (_multiply), \
366 .info = &vmstate_info_buffer, \
367 .flags = VMS_VBUFFER|VMS_MULTIPLY, \
368 .offset = offsetof(_state, _field), \
372 #define VMSTATE_VBUFFER(_field, _state, _version, _test, _start, _field_size) { \
373 .name = (stringify(_field)), \
374 .version_id = (_version), \
375 .field_exists = (_test), \
376 .size_offset = vmstate_offset_value(_state, _field_size, int32_t),\
377 .info = &vmstate_info_buffer, \
378 .flags = VMS_VBUFFER|VMS_POINTER, \
379 .offset = offsetof(_state, _field), \
383 #define VMSTATE_VBUFFER_UINT32(_field, _state, _version, _test, _start, _field_size) { \
384 .name = (stringify(_field)), \
385 .version_id = (_version), \
386 .field_exists = (_test), \
387 .size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
388 .info = &vmstate_info_buffer, \
389 .flags = VMS_VBUFFER|VMS_POINTER, \
390 .offset = offsetof(_state, _field), \
394 #define VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, _info, _size) { \
395 .name = (stringify(_field)), \
396 .version_id = (_version), \
399 .flags = VMS_BUFFER, \
400 .offset = offsetof(_state, _field), \
403 #define VMSTATE_UNUSED_BUFFER(_test, _version, _size) { \
405 .field_exists = (_test), \
406 .version_id = (_version), \
408 .info = &vmstate_info_unused_buffer, \
409 .flags = VMS_BUFFER, \
413 _f_n : num of elements field_name
415 _s : struct state name
419 #define VMSTATE_SINGLE(_field, _state, _version, _info, _type) \
420 VMSTATE_SINGLE_TEST(_field, _state, NULL, _version, _info, _type)
422 #define VMSTATE_STRUCT(_field, _state, _version, _vmsd, _type) \
423 VMSTATE_STRUCT_TEST(_field, _state, NULL, _version, _vmsd, _type)
425 #define VMSTATE_STRUCT_POINTER(_field, _state, _vmsd, _type) \
426 VMSTATE_STRUCT_POINTER_TEST(_field, _state, NULL, _vmsd, _type)
428 #define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _version, _vmsd, _type) \
429 VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, _version, \
432 #define VMSTATE_BOOL_V(_f, _s, _v) \
433 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_bool, bool)
435 #define VMSTATE_INT8_V(_f, _s, _v) \
436 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int8, int8_t)
437 #define VMSTATE_INT16_V(_f, _s, _v) \
438 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int16, int16_t)
439 #define VMSTATE_INT32_V(_f, _s, _v) \
440 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int32, int32_t)
441 #define VMSTATE_INT64_V(_f, _s, _v) \
442 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int64, int64_t)
444 #define VMSTATE_UINT8_V(_f, _s, _v) \
445 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint8, uint8_t)
446 #define VMSTATE_UINT16_V(_f, _s, _v) \
447 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16, uint16_t)
448 #define VMSTATE_UINT32_V(_f, _s, _v) \
449 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32, uint32_t)
450 #define VMSTATE_UINT64_V(_f, _s, _v) \
451 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64, uint64_t)
453 #define VMSTATE_BOOL(_f, _s) \
454 VMSTATE_BOOL_V(_f, _s, 0)
456 #define VMSTATE_INT8(_f, _s) \
457 VMSTATE_INT8_V(_f, _s, 0)
458 #define VMSTATE_INT16(_f, _s) \
459 VMSTATE_INT16_V(_f, _s, 0)
460 #define VMSTATE_INT32(_f, _s) \
461 VMSTATE_INT32_V(_f, _s, 0)
462 #define VMSTATE_INT64(_f, _s) \
463 VMSTATE_INT64_V(_f, _s, 0)
465 #define VMSTATE_UINT8(_f, _s) \
466 VMSTATE_UINT8_V(_f, _s, 0)
467 #define VMSTATE_UINT16(_f, _s) \
468 VMSTATE_UINT16_V(_f, _s, 0)
469 #define VMSTATE_UINT32(_f, _s) \
470 VMSTATE_UINT32_V(_f, _s, 0)
471 #define VMSTATE_UINT64(_f, _s) \
472 VMSTATE_UINT64_V(_f, _s, 0)
474 #define VMSTATE_UINT8_EQUAL(_f, _s) \
475 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint8_equal, uint8_t)
477 #define VMSTATE_UINT16_EQUAL(_f, _s) \
478 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint16_equal, uint16_t)
480 #define VMSTATE_UINT16_EQUAL_V(_f, _s, _v) \
481 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16_equal, uint16_t)
483 #define VMSTATE_INT32_EQUAL(_f, _s) \
484 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_equal, int32_t)
486 #define VMSTATE_UINT32_EQUAL(_f, _s) \
487 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint32_equal, uint32_t)
489 #define VMSTATE_INT32_LE(_f, _s) \
490 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
492 #define VMSTATE_UINT8_TEST(_f, _s, _t) \
493 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
495 #define VMSTATE_UINT16_TEST(_f, _s, _t) \
496 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
498 #define VMSTATE_UINT32_TEST(_f, _s, _t) \
499 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
501 #define VMSTATE_TIMER_TEST(_f, _s, _test) \
502 VMSTATE_POINTER_TEST(_f, _s, _test, vmstate_info_timer, QEMUTimer *)
504 #define VMSTATE_TIMER(_f, _s) \
505 VMSTATE_TIMER_TEST(_f, _s, NULL)
507 #define VMSTATE_TIMER_ARRAY(_f, _s, _n) \
508 VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *)
510 #define VMSTATE_BOOL_ARRAY_V(_f, _s, _n, _v) \
511 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_bool, bool)
513 #define VMSTATE_BOOL_ARRAY(_f, _s, _n) \
514 VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0)
516 #define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \
517 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
519 #define VMSTATE_UINT16_ARRAY(_f, _s, _n) \
520 VMSTATE_UINT16_ARRAY_V(_f, _s, _n, 0)
522 #define VMSTATE_UINT8_ARRAY_V(_f, _s, _n, _v) \
523 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint8, uint8_t)
525 #define VMSTATE_UINT8_ARRAY(_f, _s, _n) \
526 VMSTATE_UINT8_ARRAY_V(_f, _s, _n, 0)
528 #define VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) \
529 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint32, uint32_t)
531 #define VMSTATE_UINT32_ARRAY(_f, _s, _n) \
532 VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
534 #define VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) \
535 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint64, uint64_t)
537 #define VMSTATE_UINT64_ARRAY(_f, _s, _n) \
538 VMSTATE_UINT64_ARRAY_V(_f, _s, _n, 0)
540 #define VMSTATE_INT16_ARRAY_V(_f, _s, _n, _v) \
541 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int16, int16_t)
543 #define VMSTATE_INT16_ARRAY(_f, _s, _n) \
544 VMSTATE_INT16_ARRAY_V(_f, _s, _n, 0)
546 #define VMSTATE_INT32_ARRAY_V(_f, _s, _n, _v) \
547 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int32, int32_t)
549 #define VMSTATE_INT32_ARRAY(_f, _s, _n) \
550 VMSTATE_INT32_ARRAY_V(_f, _s, _n, 0)
552 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num) \
553 VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
555 #define VMSTATE_UINT32_ARRAY(_f, _s, _n) \
556 VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
558 #define VMSTATE_INT64_ARRAY_V(_f, _s, _n, _v) \
559 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int64, int64_t)
561 #define VMSTATE_INT64_ARRAY(_f, _s, _n) \
562 VMSTATE_INT64_ARRAY_V(_f, _s, _n, 0)
564 #define VMSTATE_BUFFER_V(_f, _s, _v) \
565 VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
567 #define VMSTATE_BUFFER(_f, _s) \
568 VMSTATE_BUFFER_V(_f, _s, 0)
570 #define VMSTATE_PARTIAL_BUFFER(_f, _s, _size) \
571 VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size)
573 #define VMSTATE_BUFFER_START_MIDDLE(_f, _s, _start) \
574 VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, _start, sizeof(typeof_field(_s, _f)))
576 #define VMSTATE_PARTIAL_VBUFFER(_f, _s, _size) \
577 VMSTATE_VBUFFER(_f, _s, 0, NULL, 0, _size)
579 #define VMSTATE_PARTIAL_VBUFFER_UINT32(_f, _s, _size) \
580 VMSTATE_VBUFFER_UINT32(_f, _s, 0, NULL, 0, _size)
582 #define VMSTATE_SUB_VBUFFER(_f, _s, _start, _size) \
583 VMSTATE_VBUFFER(_f, _s, 0, NULL, _start, _size)
585 #define VMSTATE_BUFFER_TEST(_f, _s, _test) \
586 VMSTATE_STATIC_BUFFER(_f, _s, 0, _test, 0, sizeof(typeof_field(_s, _f)))
588 #define VMSTATE_BUFFER_UNSAFE(_field, _state, _version, _size) \
589 VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, vmstate_info_buffer, _size)
591 #define VMSTATE_UNUSED_V(_v, _size) \
592 VMSTATE_UNUSED_BUFFER(NULL, _v, _size)
594 #define VMSTATE_UNUSED(_size) \
595 VMSTATE_UNUSED_V(0, _size)
597 #define VMSTATE_UNUSED_TEST(_test, _size) \
598 VMSTATE_UNUSED_BUFFER(_test, 0, _size)
600 #define VMSTATE_END_OF_LIST() \
603 int vmstate_load_state(QEMUFile
*f
, const VMStateDescription
*vmsd
,
604 void *opaque
, int version_id
);
605 void vmstate_save_state(QEMUFile
*f
, const VMStateDescription
*vmsd
,
607 int vmstate_register(DeviceState
*dev
, int instance_id
,
608 const VMStateDescription
*vmsd
, void *base
);
609 int vmstate_register_with_alias_id(DeviceState
*dev
, int instance_id
,
610 const VMStateDescription
*vmsd
,
611 void *base
, int alias_id
,
612 int required_for_version
);
613 void vmstate_unregister(DeviceState
*dev
, const VMStateDescription
*vmsd
,
617 void vmstate_register_ram(struct MemoryRegion
*memory
, DeviceState
*dev
);
618 void vmstate_unregister_ram(struct MemoryRegion
*memory
, DeviceState
*dev
);
619 void vmstate_register_ram_global(struct MemoryRegion
*memory
);