Re: [PATCH v2 01/10] migration: Use OBJECT_DECLARE_SIMPLE_TYPE
Mark Cave-Ayland <[email protected]> Wed, 10 Jun 2026 16:15:11 +0100
| Newsgroups | org.nongnu.qemu-rust,org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
On 09/06/2026 18:25, Peter Xu wrote: > Migration object's class has nothing special, switch to the newly > introduced macro. > > Suggested-by: Daniel P. Berrangé <[email protected]> > Signed-off-by: Peter Xu <[email protected]> > --- > migration/migration.h | 9 +-------- > migration/migration.c | 7 +++---- > 2 files changed, 4 insertions(+), 12 deletions(-) > > diff --git a/migration/migration.h b/migration/migration.h > index 841f49b215..293ad60e07 100644 > --- a/migration/migration.h > +++ b/migration/migration.h > @@ -263,14 +263,7 @@ void fill_destination_postcopy_migration_info(MigrationInfo *info); > > #define TYPE_MIGRATION "migration" > > -typedef struct MigrationClass MigrationClass; > -DECLARE_OBJ_CHECKERS(MigrationState, MigrationClass, > - MIGRATION_OBJ, TYPE_MIGRATION) > - > -struct MigrationClass { > - /*< private >*/ > - DeviceClass parent_class; > -}; > +OBJECT_DECLARE_SIMPLE_TYPE(MigrationState, MIGRATION); > > struct MigrationState { > /*< private >*/ > diff --git a/migration/migration.c b/migration/migration.c > index 074d3f2c69..278cad502a 100644 > --- a/migration/migration.c > +++ b/migration/migration.c > @@ -297,7 +297,7 @@ void migration_object_init(void) > { > /* This can only be called once. */ > assert(!current_migration); > - current_migration = MIGRATION_OBJ(object_new(TYPE_MIGRATION)); > + current_migration = MIGRATION(object_new(TYPE_MIGRATION)); > > /* > * Init the migrate incoming object as well no matter whether > @@ -3975,7 +3975,7 @@ static void migration_class_init(ObjectClass *klass, const void *data) > > static void migration_instance_finalize(Object *obj) > { > - MigrationState *ms = MIGRATION_OBJ(obj); > + MigrationState *ms = MIGRATION(obj); > > qapi_free_BitmapMigrationNodeAliasList(ms->parameters.block_bitmap_mapping); > qapi_free_strList(ms->parameters.cpr_exec_command); > @@ -3993,7 +3993,7 @@ static void migration_instance_finalize(Object *obj) > > static void migration_instance_init(Object *obj) > { > - MigrationState *ms = MIGRATION_OBJ(obj); > + MigrationState *ms = MIGRATION(obj); > > ms->state = MIGRATION_STATUS_NONE; > ms->mbps = -1; > @@ -4040,7 +4040,6 @@ static const TypeInfo migration_type = { > */ > .parent = TYPE_DEVICE, > .class_init = migration_class_init, > - .class_size = sizeof(MigrationClass), > .instance_size = sizeof(MigrationState), > .instance_init = migration_instance_init, > .instance_finalize = migration_instance_finalize, Reviewed-by: Mark Cave-Ayland <[email protected]> ATB, Mark.