qemu-config: introduce qemu_find_opts_err()
[qemu/opensuse.git] / vmstate.h
blob82d97aead47f710364f67a1cba5b55877b9a13bd
1 /*
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
24 * THE SOFTWARE.
26 #ifndef QEMU_VMSTATE_H
27 #define QEMU_VMSTATE_H 1
29 typedef void SaveSetParamsHandler(int blk_enable, int shared, void * opaque);
30 typedef void SaveStateHandler(QEMUFile *f, void *opaque);
31 typedef int SaveLiveStateHandler(QEMUFile *f, int stage, void *opaque);
32 typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
34 int register_savevm(DeviceState *dev,
35 const char *idstr,
36 int instance_id,
37 int version_id,
38 SaveStateHandler *save_state,
39 LoadStateHandler *load_state,
40 void *opaque);
42 int register_savevm_live(DeviceState *dev,
43 const char *idstr,
44 int instance_id,
45 int version_id,
46 SaveSetParamsHandler *set_params,
47 SaveLiveStateHandler *save_live_state,
48 SaveStateHandler *save_state,
49 LoadStateHandler *load_state,
50 void *opaque);
52 void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque);
53 void register_device_unmigratable(DeviceState *dev, const char *idstr,
54 void *opaque);
57 typedef struct VMStateInfo VMStateInfo;
58 typedef struct VMStateDescription VMStateDescription;
60 struct VMStateInfo {
61 const char *name;
62 int (*get)(QEMUFile *f, void *pv, size_t size);
63 void (*put)(QEMUFile *f, void *pv, size_t size);
66 enum VMStateFlags {
67 VMS_SINGLE = 0x001,
68 VMS_POINTER = 0x002,
69 VMS_ARRAY = 0x004,
70 VMS_STRUCT = 0x008,
71 VMS_VARRAY_INT32 = 0x010, /* Array with size in int32_t field*/
72 VMS_BUFFER = 0x020, /* static sized buffer */
73 VMS_ARRAY_OF_POINTER = 0x040,
74 VMS_VARRAY_UINT16 = 0x080, /* Array with size in uint16_t field */
75 VMS_VBUFFER = 0x100, /* Buffer with size in int32_t field */
76 VMS_MULTIPLY = 0x200, /* multiply "size" field by field_size */
77 VMS_VARRAY_UINT8 = 0x400, /* Array with size in uint8_t field*/
78 VMS_VARRAY_UINT32 = 0x800, /* Array with size in uint32_t field*/
81 typedef struct {
82 const char *name;
83 size_t offset;
84 size_t size;
85 size_t start;
86 int num;
87 size_t num_offset;
88 size_t size_offset;
89 const VMStateInfo *info;
90 enum VMStateFlags flags;
91 const VMStateDescription *vmsd;
92 int version_id;
93 bool (*field_exists)(void *opaque, int version_id);
94 } VMStateField;
96 typedef struct VMStateSubsection {
97 const VMStateDescription *vmsd;
98 bool (*needed)(void *opaque);
99 } VMStateSubsection;
101 struct VMStateDescription {
102 const char *name;
103 int unmigratable;
104 int version_id;
105 int minimum_version_id;
106 int minimum_version_id_old;
107 LoadStateHandler *load_state_old;
108 int (*pre_load)(void *opaque);
109 int (*post_load)(void *opaque, int version_id);
110 void (*pre_save)(void *opaque);
111 VMStateField *fields;
112 const VMStateSubsection *subsections;
115 extern const VMStateInfo vmstate_info_bool;
117 extern const VMStateInfo vmstate_info_int8;
118 extern const VMStateInfo vmstate_info_int16;
119 extern const VMStateInfo vmstate_info_int32;
120 extern const VMStateInfo vmstate_info_int64;
122 extern const VMStateInfo vmstate_info_uint8_equal;
123 extern const VMStateInfo vmstate_info_uint16_equal;
124 extern const VMStateInfo vmstate_info_int32_equal;
125 extern const VMStateInfo vmstate_info_uint32_equal;
126 extern const VMStateInfo vmstate_info_int32_le;
128 extern const VMStateInfo vmstate_info_uint8;
129 extern const VMStateInfo vmstate_info_uint16;
130 extern const VMStateInfo vmstate_info_uint32;
131 extern const VMStateInfo vmstate_info_uint64;
133 extern const VMStateInfo vmstate_info_timer;
134 extern const VMStateInfo vmstate_info_buffer;
135 extern const VMStateInfo vmstate_info_unused_buffer;
137 #define type_check_array(t1,t2,n) ((t1(*)[n])0 - (t2*)0)
138 #define type_check_pointer(t1,t2) ((t1**)0 - (t2*)0)
140 #define vmstate_offset_value(_state, _field, _type) \
141 (offsetof(_state, _field) + \
142 type_check(_type, typeof_field(_state, _field)))
144 #define vmstate_offset_pointer(_state, _field, _type) \
145 (offsetof(_state, _field) + \
146 type_check_pointer(_type, typeof_field(_state, _field)))
148 #define vmstate_offset_array(_state, _field, _type, _num) \
149 (offsetof(_state, _field) + \
150 type_check_array(_type, typeof_field(_state, _field), _num))
152 #define vmstate_offset_sub_array(_state, _field, _type, _start) \
153 (offsetof(_state, _field[_start]))
155 #define vmstate_offset_buffer(_state, _field) \
156 vmstate_offset_array(_state, _field, uint8_t, \
157 sizeof(typeof_field(_state, _field)))
159 #define VMSTATE_SINGLE_TEST(_field, _state, _test, _version, _info, _type) { \
160 .name = (stringify(_field)), \
161 .version_id = (_version), \
162 .field_exists = (_test), \
163 .size = sizeof(_type), \
164 .info = &(_info), \
165 .flags = VMS_SINGLE, \
166 .offset = vmstate_offset_value(_state, _field, _type), \
169 #define VMSTATE_POINTER(_field, _state, _version, _info, _type) { \
170 .name = (stringify(_field)), \
171 .version_id = (_version), \
172 .info = &(_info), \
173 .size = sizeof(_type), \
174 .flags = VMS_SINGLE|VMS_POINTER, \
175 .offset = vmstate_offset_value(_state, _field, _type), \
178 #define VMSTATE_POINTER_TEST(_field, _state, _test, _info, _type) { \
179 .name = (stringify(_field)), \
180 .info = &(_info), \
181 .field_exists = (_test), \
182 .size = sizeof(_type), \
183 .flags = VMS_SINGLE|VMS_POINTER, \
184 .offset = vmstate_offset_value(_state, _field, _type), \
187 #define VMSTATE_ARRAY(_field, _state, _num, _version, _info, _type) {\
188 .name = (stringify(_field)), \
189 .version_id = (_version), \
190 .num = (_num), \
191 .info = &(_info), \
192 .size = sizeof(_type), \
193 .flags = VMS_ARRAY, \
194 .offset = vmstate_offset_array(_state, _field, _type, _num), \
197 #define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\
198 .name = (stringify(_field)), \
199 .field_exists = (_test), \
200 .num = (_num), \
201 .info = &(_info), \
202 .size = sizeof(_type), \
203 .flags = VMS_ARRAY, \
204 .offset = vmstate_offset_array(_state, _field, _type, _num),\
207 #define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _version, _info, _type) { \
208 .name = (stringify(_field)), \
209 .version_id = (_version), \
210 .num = (_num), \
211 .info = &(_info), \
212 .size = sizeof(_type), \
213 .flags = VMS_ARRAY, \
214 .offset = vmstate_offset_sub_array(_state, _field, _type, _start), \
217 #define VMSTATE_ARRAY_INT32_UNSAFE(_field, _state, _field_num, _info, _type) {\
218 .name = (stringify(_field)), \
219 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
220 .info = &(_info), \
221 .size = sizeof(_type), \
222 .flags = VMS_VARRAY_INT32, \
223 .offset = offsetof(_state, _field), \
226 #define VMSTATE_VARRAY_INT32(_field, _state, _field_num, _version, _info, _type) {\
227 .name = (stringify(_field)), \
228 .version_id = (_version), \
229 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
230 .info = &(_info), \
231 .size = sizeof(_type), \
232 .flags = VMS_VARRAY_INT32|VMS_POINTER, \
233 .offset = vmstate_offset_pointer(_state, _field, _type), \
236 #define VMSTATE_VARRAY_UINT32(_field, _state, _field_num, _version, _info, _type) {\
237 .name = (stringify(_field)), \
238 .version_id = (_version), \
239 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
240 .info = &(_info), \
241 .size = sizeof(_type), \
242 .flags = VMS_VARRAY_UINT32|VMS_POINTER, \
243 .offset = vmstate_offset_pointer(_state, _field, _type), \
246 #define VMSTATE_VARRAY_UINT16_UNSAFE(_field, _state, _field_num, _version, _info, _type) {\
247 .name = (stringify(_field)), \
248 .version_id = (_version), \
249 .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
250 .info = &(_info), \
251 .size = sizeof(_type), \
252 .flags = VMS_VARRAY_UINT16, \
253 .offset = offsetof(_state, _field), \
256 #define VMSTATE_STRUCT_TEST(_field, _state, _test, _version, _vmsd, _type) { \
257 .name = (stringify(_field)), \
258 .version_id = (_version), \
259 .field_exists = (_test), \
260 .vmsd = &(_vmsd), \
261 .size = sizeof(_type), \
262 .flags = VMS_STRUCT, \
263 .offset = vmstate_offset_value(_state, _field, _type), \
266 #define VMSTATE_STRUCT_POINTER_TEST(_field, _state, _test, _vmsd, _type) { \
267 .name = (stringify(_field)), \
268 .field_exists = (_test), \
269 .vmsd = &(_vmsd), \
270 .size = sizeof(_type), \
271 .flags = VMS_STRUCT|VMS_POINTER, \
272 .offset = vmstate_offset_value(_state, _field, _type), \
275 #define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _version, _info, _type) {\
276 .name = (stringify(_field)), \
277 .version_id = (_version), \
278 .num = (_num), \
279 .info = &(_info), \
280 .size = sizeof(_type), \
281 .flags = VMS_ARRAY|VMS_ARRAY_OF_POINTER, \
282 .offset = vmstate_offset_array(_state, _field, _type, _num), \
285 #define VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, _test, _version, _vmsd, _type) { \
286 .name = (stringify(_field)), \
287 .num = (_num), \
288 .field_exists = (_test), \
289 .version_id = (_version), \
290 .vmsd = &(_vmsd), \
291 .size = sizeof(_type), \
292 .flags = VMS_STRUCT|VMS_ARRAY, \
293 .offset = vmstate_offset_array(_state, _field, _type, _num),\
296 #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
297 .name = (stringify(_field)), \
298 .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
299 .version_id = (_version), \
300 .vmsd = &(_vmsd), \
301 .size = sizeof(_type), \
302 .flags = VMS_STRUCT|VMS_VARRAY_UINT8, \
303 .offset = offsetof(_state, _field), \
306 #define VMSTATE_STRUCT_VARRAY_POINTER_INT32(_field, _state, _field_num, _vmsd, _type) { \
307 .name = (stringify(_field)), \
308 .version_id = 0, \
309 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
310 .size = sizeof(_type), \
311 .vmsd = &(_vmsd), \
312 .flags = VMS_POINTER | VMS_VARRAY_INT32 | VMS_STRUCT, \
313 .offset = vmstate_offset_pointer(_state, _field, _type), \
316 #define VMSTATE_STRUCT_VARRAY_POINTER_UINT16(_field, _state, _field_num, _vmsd, _type) { \
317 .name = (stringify(_field)), \
318 .version_id = 0, \
319 .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
320 .size = sizeof(_type), \
321 .vmsd = &(_vmsd), \
322 .flags = VMS_POINTER | VMS_VARRAY_UINT16 | VMS_STRUCT, \
323 .offset = vmstate_offset_pointer(_state, _field, _type), \
326 #define VMSTATE_STRUCT_VARRAY_INT32(_field, _state, _field_num, _version, _vmsd, _type) { \
327 .name = (stringify(_field)), \
328 .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
329 .version_id = (_version), \
330 .vmsd = &(_vmsd), \
331 .size = sizeof(_type), \
332 .flags = VMS_STRUCT|VMS_VARRAY_INT32, \
333 .offset = offsetof(_state, _field), \
336 #define VMSTATE_STRUCT_VARRAY_UINT32(_field, _state, _field_num, _version, _vmsd, _type) { \
337 .name = (stringify(_field)), \
338 .num_offset = vmstate_offset_value(_state, _field_num, uint32_t), \
339 .version_id = (_version), \
340 .vmsd = &(_vmsd), \
341 .size = sizeof(_type), \
342 .flags = VMS_STRUCT|VMS_VARRAY_UINT32, \
343 .offset = offsetof(_state, _field), \
346 #define VMSTATE_STATIC_BUFFER(_field, _state, _version, _test, _start, _size) { \
347 .name = (stringify(_field)), \
348 .version_id = (_version), \
349 .field_exists = (_test), \
350 .size = (_size - _start), \
351 .info = &vmstate_info_buffer, \
352 .flags = VMS_BUFFER, \
353 .offset = vmstate_offset_buffer(_state, _field) + _start, \
356 #define VMSTATE_BUFFER_MULTIPLY(_field, _state, _version, _test, _start, _field_size, _multiply) { \
357 .name = (stringify(_field)), \
358 .version_id = (_version), \
359 .field_exists = (_test), \
360 .size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
361 .size = (_multiply), \
362 .info = &vmstate_info_buffer, \
363 .flags = VMS_VBUFFER|VMS_MULTIPLY, \
364 .offset = offsetof(_state, _field), \
365 .start = (_start), \
368 #define VMSTATE_VBUFFER(_field, _state, _version, _test, _start, _field_size) { \
369 .name = (stringify(_field)), \
370 .version_id = (_version), \
371 .field_exists = (_test), \
372 .size_offset = vmstate_offset_value(_state, _field_size, int32_t),\
373 .info = &vmstate_info_buffer, \
374 .flags = VMS_VBUFFER|VMS_POINTER, \
375 .offset = offsetof(_state, _field), \
376 .start = (_start), \
379 #define VMSTATE_VBUFFER_UINT32(_field, _state, _version, _test, _start, _field_size) { \
380 .name = (stringify(_field)), \
381 .version_id = (_version), \
382 .field_exists = (_test), \
383 .size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
384 .info = &vmstate_info_buffer, \
385 .flags = VMS_VBUFFER|VMS_POINTER, \
386 .offset = offsetof(_state, _field), \
387 .start = (_start), \
390 #define VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, _info, _size) { \
391 .name = (stringify(_field)), \
392 .version_id = (_version), \
393 .size = (_size), \
394 .info = &(_info), \
395 .flags = VMS_BUFFER, \
396 .offset = offsetof(_state, _field), \
399 #define VMSTATE_UNUSED_BUFFER(_test, _version, _size) { \
400 .name = "unused", \
401 .field_exists = (_test), \
402 .version_id = (_version), \
403 .size = (_size), \
404 .info = &vmstate_info_unused_buffer, \
405 .flags = VMS_BUFFER, \
408 /* _f : field name
409 _f_n : num of elements field_name
410 _n : num of elements
411 _s : struct state name
412 _v : version
415 #define VMSTATE_SINGLE(_field, _state, _version, _info, _type) \
416 VMSTATE_SINGLE_TEST(_field, _state, NULL, _version, _info, _type)
418 #define VMSTATE_STRUCT(_field, _state, _version, _vmsd, _type) \
419 VMSTATE_STRUCT_TEST(_field, _state, NULL, _version, _vmsd, _type)
421 #define VMSTATE_STRUCT_POINTER(_field, _state, _vmsd, _type) \
422 VMSTATE_STRUCT_POINTER_TEST(_field, _state, NULL, _vmsd, _type)
424 #define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _version, _vmsd, _type) \
425 VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, _version, \
426 _vmsd, _type)
428 #define VMSTATE_BOOL_V(_f, _s, _v) \
429 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_bool, bool)
431 #define VMSTATE_INT8_V(_f, _s, _v) \
432 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int8, int8_t)
433 #define VMSTATE_INT16_V(_f, _s, _v) \
434 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int16, int16_t)
435 #define VMSTATE_INT32_V(_f, _s, _v) \
436 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int32, int32_t)
437 #define VMSTATE_INT64_V(_f, _s, _v) \
438 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int64, int64_t)
440 #define VMSTATE_UINT8_V(_f, _s, _v) \
441 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint8, uint8_t)
442 #define VMSTATE_UINT16_V(_f, _s, _v) \
443 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16, uint16_t)
444 #define VMSTATE_UINT32_V(_f, _s, _v) \
445 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32, uint32_t)
446 #define VMSTATE_UINT64_V(_f, _s, _v) \
447 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64, uint64_t)
449 #define VMSTATE_BOOL(_f, _s) \
450 VMSTATE_BOOL_V(_f, _s, 0)
452 #define VMSTATE_INT8(_f, _s) \
453 VMSTATE_INT8_V(_f, _s, 0)
454 #define VMSTATE_INT16(_f, _s) \
455 VMSTATE_INT16_V(_f, _s, 0)
456 #define VMSTATE_INT32(_f, _s) \
457 VMSTATE_INT32_V(_f, _s, 0)
458 #define VMSTATE_INT64(_f, _s) \
459 VMSTATE_INT64_V(_f, _s, 0)
461 #define VMSTATE_UINT8(_f, _s) \
462 VMSTATE_UINT8_V(_f, _s, 0)
463 #define VMSTATE_UINT16(_f, _s) \
464 VMSTATE_UINT16_V(_f, _s, 0)
465 #define VMSTATE_UINT32(_f, _s) \
466 VMSTATE_UINT32_V(_f, _s, 0)
467 #define VMSTATE_UINT64(_f, _s) \
468 VMSTATE_UINT64_V(_f, _s, 0)
470 #define VMSTATE_UINT8_EQUAL(_f, _s) \
471 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint8_equal, uint8_t)
473 #define VMSTATE_UINT16_EQUAL(_f, _s) \
474 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint16_equal, uint16_t)
476 #define VMSTATE_UINT16_EQUAL_V(_f, _s, _v) \
477 VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16_equal, uint16_t)
479 #define VMSTATE_INT32_EQUAL(_f, _s) \
480 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_equal, int32_t)
482 #define VMSTATE_UINT32_EQUAL(_f, _s) \
483 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint32_equal, uint32_t)
485 #define VMSTATE_INT32_LE(_f, _s) \
486 VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
488 #define VMSTATE_UINT8_TEST(_f, _s, _t) \
489 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
491 #define VMSTATE_UINT16_TEST(_f, _s, _t) \
492 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
494 #define VMSTATE_UINT32_TEST(_f, _s, _t) \
495 VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
497 #define VMSTATE_TIMER_TEST(_f, _s, _test) \
498 VMSTATE_POINTER_TEST(_f, _s, _test, vmstate_info_timer, QEMUTimer *)
500 #define VMSTATE_TIMER(_f, _s) \
501 VMSTATE_TIMER_TEST(_f, _s, NULL)
503 #define VMSTATE_TIMER_ARRAY(_f, _s, _n) \
504 VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *)
506 #define VMSTATE_BOOL_ARRAY_V(_f, _s, _n, _v) \
507 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_bool, bool)
509 #define VMSTATE_BOOL_ARRAY(_f, _s, _n) \
510 VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0)
512 #define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \
513 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
515 #define VMSTATE_UINT16_ARRAY(_f, _s, _n) \
516 VMSTATE_UINT16_ARRAY_V(_f, _s, _n, 0)
518 #define VMSTATE_UINT8_ARRAY_V(_f, _s, _n, _v) \
519 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint8, uint8_t)
521 #define VMSTATE_UINT8_ARRAY(_f, _s, _n) \
522 VMSTATE_UINT8_ARRAY_V(_f, _s, _n, 0)
524 #define VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) \
525 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint32, uint32_t)
527 #define VMSTATE_UINT32_ARRAY(_f, _s, _n) \
528 VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
530 #define VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) \
531 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint64, uint64_t)
533 #define VMSTATE_UINT64_ARRAY(_f, _s, _n) \
534 VMSTATE_UINT64_ARRAY_V(_f, _s, _n, 0)
536 #define VMSTATE_INT16_ARRAY_V(_f, _s, _n, _v) \
537 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int16, int16_t)
539 #define VMSTATE_INT16_ARRAY(_f, _s, _n) \
540 VMSTATE_INT16_ARRAY_V(_f, _s, _n, 0)
542 #define VMSTATE_INT32_ARRAY_V(_f, _s, _n, _v) \
543 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int32, int32_t)
545 #define VMSTATE_INT32_ARRAY(_f, _s, _n) \
546 VMSTATE_INT32_ARRAY_V(_f, _s, _n, 0)
548 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num) \
549 VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
551 #define VMSTATE_UINT32_ARRAY(_f, _s, _n) \
552 VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
554 #define VMSTATE_INT64_ARRAY_V(_f, _s, _n, _v) \
555 VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int64, int64_t)
557 #define VMSTATE_INT64_ARRAY(_f, _s, _n) \
558 VMSTATE_INT64_ARRAY_V(_f, _s, _n, 0)
560 #define VMSTATE_BUFFER_V(_f, _s, _v) \
561 VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
563 #define VMSTATE_BUFFER(_f, _s) \
564 VMSTATE_BUFFER_V(_f, _s, 0)
566 #define VMSTATE_PARTIAL_BUFFER(_f, _s, _size) \
567 VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size)
569 #define VMSTATE_BUFFER_START_MIDDLE(_f, _s, _start) \
570 VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, _start, sizeof(typeof_field(_s, _f)))
572 #define VMSTATE_PARTIAL_VBUFFER(_f, _s, _size) \
573 VMSTATE_VBUFFER(_f, _s, 0, NULL, 0, _size)
575 #define VMSTATE_PARTIAL_VBUFFER_UINT32(_f, _s, _size) \
576 VMSTATE_VBUFFER_UINT32(_f, _s, 0, NULL, 0, _size)
578 #define VMSTATE_SUB_VBUFFER(_f, _s, _start, _size) \
579 VMSTATE_VBUFFER(_f, _s, 0, NULL, _start, _size)
581 #define VMSTATE_BUFFER_TEST(_f, _s, _test) \
582 VMSTATE_STATIC_BUFFER(_f, _s, 0, _test, 0, sizeof(typeof_field(_s, _f)))
584 #define VMSTATE_BUFFER_UNSAFE(_field, _state, _version, _size) \
585 VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, vmstate_info_buffer, _size)
587 #define VMSTATE_UNUSED_V(_v, _size) \
588 VMSTATE_UNUSED_BUFFER(NULL, _v, _size)
590 #define VMSTATE_UNUSED(_size) \
591 VMSTATE_UNUSED_V(0, _size)
593 #define VMSTATE_UNUSED_TEST(_test, _size) \
594 VMSTATE_UNUSED_BUFFER(_test, 0, _size)
596 #define VMSTATE_END_OF_LIST() \
599 int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
600 void *opaque, int version_id);
601 void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
602 void *opaque);
603 int vmstate_register(DeviceState *dev, int instance_id,
604 const VMStateDescription *vmsd, void *base);
605 int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
606 const VMStateDescription *vmsd,
607 void *base, int alias_id,
608 int required_for_version);
609 void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
610 void *opaque);
612 struct MemoryRegion;
613 void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev);
614 void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
615 void vmstate_register_ram_global(struct MemoryRegion *memory);
617 #endif