hw/arm/orangepi: check for potential NULL pointer when calling blk_is_available
[qemu/ar7.git] / include / hw / vmstate-if.h
blob8ff7f0f2929813f8b7cda82f6e4b877f82757b77
1 /*
2 * VMState interface
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 */
9 #ifndef VMSTATE_IF_H
10 #define VMSTATE_IF_H
12 #include "qom/object.h"
14 #define TYPE_VMSTATE_IF "vmstate-if"
16 #define VMSTATE_IF_CLASS(klass) \
17 OBJECT_CLASS_CHECK(VMStateIfClass, (klass), TYPE_VMSTATE_IF)
18 #define VMSTATE_IF_GET_CLASS(obj) \
19 OBJECT_GET_CLASS(VMStateIfClass, (obj), TYPE_VMSTATE_IF)
20 #define VMSTATE_IF(obj) \
21 INTERFACE_CHECK(VMStateIf, (obj), TYPE_VMSTATE_IF)
23 typedef struct VMStateIf VMStateIf;
25 typedef struct VMStateIfClass {
26 InterfaceClass parent_class;
28 char * (*get_id)(VMStateIf *obj);
29 } VMStateIfClass;
31 static inline char *vmstate_if_get_id(VMStateIf *vmif)
33 if (!vmif) {
34 return NULL;
37 return VMSTATE_IF_GET_CLASS(vmif)->get_id(vmif);
40 #endif /* VMSTATE_IF_H */