aboutsummaryrefslogtreecommitdiff
path: root/include/hw/vmstate-if.h
blob: eabf5b05adb3090677ad2eb5af4cc7fbceb2cacf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * VMState interface
 *
 * Copyright (c) 2009-2019 Red Hat Inc
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 */

#ifndef VMSTATE_IF_H
#define VMSTATE_IF_H

#include "qom/object.h"

#define TYPE_VMSTATE_IF "vmstate-if"

typedef struct VMStateIfClass VMStateIfClass;
#define VMSTATE_IF_CLASS(klass)                                     \
    OBJECT_CLASS_CHECK(VMStateIfClass, (klass), TYPE_VMSTATE_IF)
#define VMSTATE_IF_GET_CLASS(obj)                           \
    OBJECT_GET_CLASS(VMStateIfClass, (obj), TYPE_VMSTATE_IF)
#define VMSTATE_IF(obj)                             \
    INTERFACE_CHECK(VMStateIf, (obj), TYPE_VMSTATE_IF)

typedef struct VMStateIf VMStateIf;

struct VMStateIfClass {
    InterfaceClass parent_class;

    char * (*get_id)(VMStateIf *obj);
};

static inline char *vmstate_if_get_id(VMStateIf *vmif)
{
    if (!vmif) {
        return NULL;
    }

    return VMSTATE_IF_GET_CLASS(vmif)->get_id(vmif);
}

#endif /* VMSTATE_IF_H */