summaryrefslogtreecommitdiffstats
path: root/hw/core
diff options
context:
space:
mode:
authorEduardo Habkost2015-08-20 23:54:36 +0200
committerAndreas Färber2015-09-19 16:39:28 +0200
commit98cec76a7076c4a38e16f1a9de170a7942b3be54 (patch)
tree22f0ef15c6c434a10033aeaf77717851e4fc3127 /hw/core
parentmachine: Ensure all TYPE_MACHINE subclasses have the right suffix (diff)
downloadqemu-98cec76a7076c4a38e16f1a9de170a7942b3be54.tar.gz
qemu-98cec76a7076c4a38e16f1a9de170a7942b3be54.tar.xz
qemu-98cec76a7076c4a38e16f1a9de170a7942b3be54.zip
machine: Set MachineClass::name automatically
Now all TYPE_MACHINE subclasses use MACHINE_TYPE_NAME to generate the class name. So instead of requiring each subclass to set MachineClass::name manually, we can now set it automatically at the TYPE_MACHINE class_base_init() function. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> [AF/ehabkost: Updated for s390-ccw machines] [AF: Cleanup of intermediate virt and vexpress name handling] Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/machine.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 3c1f248e80..f4db340468 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -319,8 +319,11 @@ static void machine_class_init(ObjectClass *oc, void *data)
static void machine_class_base_init(ObjectClass *oc, void *data)
{
if (!object_class_is_abstract(oc)) {
+ MachineClass *mc = MACHINE_CLASS(oc);
const char *cname = object_class_get_name(oc);
assert(g_str_has_suffix(cname, TYPE_MACHINE_SUFFIX));
+ mc->name = g_strndup(cname,
+ strlen(cname) - strlen(TYPE_MACHINE_SUFFIX));
}
}