diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2014-09-26 17:45:21 -0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-10-04 08:59:15 +0200 |
commit | b14a0b7469fa3e6c26d18438531d26138c55b67e (patch) | |
tree | 03c4c3a3b31b23bcbd684620b21988a65db4c544 /include/sysemu/accel.h | |
parent | a22465520060951e70124729521318a559a3fe88 (diff) |
accel: Use QOM classes for accel types
Instead of having a static AccelType array, register a class for each
accelerator type, and use class name lookup to find accelerator
information.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/sysemu/accel.h')
-rw-r--r-- | include/sysemu/accel.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 5537d74406..120ca0e5c0 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -24,6 +24,36 @@ #define HW_ACCEL_H #include "qemu/typedefs.h" +#include "qom/object.h" + +typedef struct AccelState { + /*< private >*/ + Object parent_obj; +} AccelState; + +typedef struct AccelClass { + /*< private >*/ + ObjectClass parent_class; + /*< public >*/ + + const char *opt_name; + const char *name; + int (*available)(void); + int (*init)(MachineClass *mc); + bool *allowed; +} AccelClass; + +#define TYPE_ACCEL "accel" + +#define ACCEL_CLASS_SUFFIX "-" TYPE_ACCEL +#define ACCEL_CLASS_NAME(a) (a ACCEL_CLASS_SUFFIX) + +#define ACCEL_CLASS(klass) \ + OBJECT_CLASS_CHECK(AccelClass, (klass), TYPE_ACCEL) +#define ACCEL(obj) \ + OBJECT_CHECK(AccelState, (obj), TYPE_ACCEL) +#define ACCEL_GET_CLASS(obj) \ + OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL) extern int tcg_tb_size; |