Message ID | 1409344310-5441-16-git-send-email-ehabkost@redhat.com |
---|---|
State | New |
Headers | show |
Il 29/08/2014 22:31, Eduardo Habkost ha scritto: > Create an actual TYPE_ACCEL object when initializing a machine. This > will allow accelerator classes to implement some initialization on > instance_init, and to save state on the TYPE_ACCEL object. > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > hw/core/accel.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/hw/core/accel.c b/hw/core/accel.c > index 98fcf0d..66ee1fa 100644 > --- a/hw/core/accel.c > +++ b/hw/core/accel.c > @@ -60,11 +60,15 @@ static AccelClass *accel_find(const char *opt_name) > > static int accel_init_machine(AccelClass *acc, MachineState *ms) > { > + ObjectClass *oc = OBJECT_CLASS(acc); > + const char *cname = object_class_get_name(oc); > + AccelState *accel = ACCEL(object_new(cname)); > int ret; > *(acc->allowed) = true; > ret = acc->init_machine(ms); > if (ret < 0) { > *(acc->allowed) = false; > + object_unref(OBJECT(accel)); > } > return ret; > } > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/hw/core/accel.c b/hw/core/accel.c index 98fcf0d..66ee1fa 100644 --- a/hw/core/accel.c +++ b/hw/core/accel.c @@ -60,11 +60,15 @@ static AccelClass *accel_find(const char *opt_name) static int accel_init_machine(AccelClass *acc, MachineState *ms) { + ObjectClass *oc = OBJECT_CLASS(acc); + const char *cname = object_class_get_name(oc); + AccelState *accel = ACCEL(object_new(cname)); int ret; *(acc->allowed) = true; ret = acc->init_machine(ms); if (ret < 0) { *(acc->allowed) = false; + object_unref(OBJECT(accel)); } return ret; }
Create an actual TYPE_ACCEL object when initializing a machine. This will allow accelerator classes to implement some initialization on instance_init, and to save state on the TYPE_ACCEL object. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- hw/core/accel.c | 4 ++++ 1 file changed, 4 insertions(+)