Fabiano Rosas <faro...@suse.de> writes:

> Steve Sistare <steven.sist...@oracle.com> writes:
>
>> Define vmstate_register_named which takes the instance name as its first
>> parameter, instead of generating the name from VMStateIf of the Object.
>> This will be needed to register objects that are not Objects.  Pass the
>> new name parameter to vmstate_register_with_alias_id.
>>
>> Signed-off-by: Steve Sistare <steven.sist...@oracle.com>
>
> Reviewed-by: Fabiano Rosas <faro...@suse.de>

Actually, can't we define a wrapper type just for this purpose? For
example, looking at dbus-vmstate.c:

static void dbus_vmstate_class_init(ObjectClass *oc, void *data)
{
...
    VMStateIfClass *vc = VMSTATE_IF_CLASS(oc);

    vc->get_id = dbus_vmstate_get_id;
...
}

static const TypeInfo dbus_vmstate_info = {
    .name = TYPE_DBUS_VMSTATE,
    .parent = TYPE_OBJECT,
    .instance_size = sizeof(DBusVMState),
    .instance_finalize = dbus_vmstate_finalize,
    .class_init = dbus_vmstate_class_init,
    .interfaces = (InterfaceInfo[]) {
        { TYPE_USER_CREATABLE },   // without this one
        { TYPE_VMSTATE_IF },
        { }
    }
};

static void register_types(void)
{
    type_register_static(&dbus_vmstate_info);
}
type_init(register_types);

Reply via email to