xref: /openbmc/qemu/include/hw/vmstate-if.h (revision 6016b7b4)
1 /*
2  * VMState interface
3  *
4  * Copyright (c) 2009-2019 Red Hat Inc
5  * This work is licensed under the terms of the GNU GPL, version 2 or later.
6  * See the COPYING file in the top-level directory.
7  */
8 
9 #ifndef VMSTATE_IF_H
10 #define VMSTATE_IF_H
11 
12 #include "qom/object.h"
13 
14 #define TYPE_VMSTATE_IF "vmstate-if"
15 
16 typedef struct VMStateIfClass VMStateIfClass;
17 DECLARE_CLASS_CHECKERS(VMStateIfClass, VMSTATE_IF,
18                        TYPE_VMSTATE_IF)
19 #define VMSTATE_IF(obj)                             \
20     INTERFACE_CHECK(VMStateIf, (obj), TYPE_VMSTATE_IF)
21 
22 typedef struct VMStateIf VMStateIf;
23 
24 struct VMStateIfClass {
25     InterfaceClass parent_class;
26 
27     char * (*get_id)(VMStateIf *obj);
28 };
29 
30 static inline char *vmstate_if_get_id(VMStateIf *vmif)
31 {
32     if (!vmif) {
33         return NULL;
34     }
35 
36     return VMSTATE_IF_GET_CLASS(vmif)->get_id(vmif);
37 }
38 
39 #endif /* VMSTATE_IF_H */
40