qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Markus Armbruster" <armbru@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH RFC 7/7] machine: register properties against the class instead of object
Date: Wed, 26 Aug 2015 13:03:14 +0100	[thread overview]
Message-ID: <1440590594-5514-8-git-send-email-berrange@redhat.com> (raw)
In-Reply-To: <1440590594-5514-1-git-send-email-berrange@redhat.com>

This converts the machine base object to register its properties
against the class rather than object.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 hw/core/machine.c | 193 +++++++++++++++++++++++++++---------------------------
 1 file changed, 97 insertions(+), 96 deletions(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index ac4654e..0fd80d3 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -300,6 +300,103 @@ static void machine_class_init(ObjectClass *oc, void *data)
 
     /* Default 128 MB as guest ram size */
     mc->default_ram_size = 128 * M_BYTE;
+
+    object_class_property_add_str(oc, "accel",
+                                  machine_get_accel, machine_set_accel, NULL);
+    object_class_property_set_description(oc, "accel",
+                                          "Accelerator list",
+                                          NULL);
+    object_class_property_add_bool(oc, "kernel-irqchip",
+                                   NULL,
+                                   machine_set_kernel_irqchip,
+                                   NULL);
+    object_class_property_set_description(oc, "kernel-irqchip",
+                                          "Use KVM in-kernel irqchip",
+                                          NULL);
+    object_class_property_add(oc, "kvm-shadow-mem", "int",
+                              machine_get_kvm_shadow_mem,
+                              machine_set_kvm_shadow_mem,
+                              NULL, NULL, NULL);
+    object_class_property_set_description(oc, "kvm-shadow-mem",
+                                          "KVM shadow MMU size",
+                                          NULL);
+    object_class_property_add_str(oc, "kernel",
+                                  machine_get_kernel, machine_set_kernel, NULL);
+    object_class_property_set_description(oc, "kernel",
+                                          "Linux kernel image file",
+                                          NULL);
+    object_class_property_add_str(oc, "initrd",
+                                  machine_get_initrd, machine_set_initrd, NULL);
+    object_class_property_set_description(oc, "initrd",
+                                          "Linux initial ramdisk file",
+                                          NULL);
+    object_class_property_add_str(oc, "append",
+                                  machine_get_append, machine_set_append, NULL);
+    object_class_property_set_description(oc, "append",
+                                          "Linux kernel command line",
+                                          NULL);
+    object_class_property_add_str(oc, "dtb",
+                                  machine_get_dtb, machine_set_dtb, NULL);
+    object_class_property_set_description(oc, "dtb",
+                                          "Linux kernel device tree file",
+                                          NULL);
+    object_class_property_add_str(oc, "dumpdtb",
+                                  machine_get_dumpdtb,
+                                  machine_set_dumpdtb, NULL);
+    object_class_property_set_description(oc, "dumpdtb",
+                                          "Dump current dtb to a file and quit",
+                                          NULL);
+    object_class_property_add(oc, "phandle-start", "int",
+                              machine_get_phandle_start,
+                              machine_set_phandle_start,
+                              NULL, NULL, NULL);
+    object_class_property_set_description(oc, "phandle-start",
+                                          "The first phandle ID we may generate dynamically",
+                                          NULL);
+    object_class_property_add_str(oc, "dt-compatible",
+                                  machine_get_dt_compatible,
+                                  machine_set_dt_compatible,
+                                  NULL);
+    object_class_property_set_description(oc, "dt-compatible",
+                                          "Overrides the \"compatible\" property of the dt root node",
+                                          NULL);
+    object_class_property_add_bool(oc, "dump-guest-core",
+                                   machine_get_dump_guest_core,
+                                   machine_set_dump_guest_core,
+                                   NULL);
+    object_class_property_set_description(oc, "dump-guest-core",
+                                          "Include guest memory in  a core dump",
+                                          NULL);
+    object_class_property_add_bool(oc, "mem-merge",
+                                   machine_get_mem_merge,
+                                   machine_set_mem_merge, NULL);
+    object_class_property_set_description(oc, "mem-merge",
+                                          "Enable/disable memory merge support",
+                                          NULL);
+    object_class_property_add_bool(oc, "usb",
+                                   machine_get_usb,
+                                   machine_set_usb, NULL);
+    object_class_property_set_description(oc, "usb",
+                                          "Set on/off to enable/disable usb",
+                                          NULL);
+    object_class_property_add_str(oc, "firmware",
+                                  machine_get_firmware,
+                                  machine_set_firmware, NULL);
+    object_class_property_set_description(oc, "firmware",
+                                          "Firmware image",
+                                          NULL);
+    object_class_property_add_bool(oc, "iommu",
+                                   machine_get_iommu,
+                                   machine_set_iommu, NULL);
+    object_class_property_set_description(oc, "iommu",
+                                          "Set on/off to enable/disable Intel IOMMU (VT-d)",
+                                          NULL);
+    object_class_property_add_bool(oc, "suppress-vmdesc",
+                                   machine_get_suppress_vmdesc,
+                                   machine_set_suppress_vmdesc, NULL);
+    object_class_property_set_description(oc, "suppress-vmdesc",
+                                          "Set on to disable self-describing migration",
+                                          NULL);
 }
 
 static void machine_initfn(Object *obj)
@@ -311,102 +408,6 @@ static void machine_initfn(Object *obj)
     ms->dump_guest_core = true;
     ms->mem_merge = true;
 
-    object_property_add_str(obj, "accel",
-                            machine_get_accel, machine_set_accel, NULL);
-    object_property_set_description(obj, "accel",
-                                    "Accelerator list",
-                                    NULL);
-    object_property_add_bool(obj, "kernel-irqchip",
-                             NULL,
-                             machine_set_kernel_irqchip,
-                             NULL);
-    object_property_set_description(obj, "kernel-irqchip",
-                                    "Use KVM in-kernel irqchip",
-                                    NULL);
-    object_property_add(obj, "kvm-shadow-mem", "int",
-                        machine_get_kvm_shadow_mem,
-                        machine_set_kvm_shadow_mem,
-                        NULL, NULL, NULL);
-    object_property_set_description(obj, "kvm-shadow-mem",
-                                    "KVM shadow MMU size",
-                                    NULL);
-    object_property_add_str(obj, "kernel",
-                            machine_get_kernel, machine_set_kernel, NULL);
-    object_property_set_description(obj, "kernel",
-                                    "Linux kernel image file",
-                                    NULL);
-    object_property_add_str(obj, "initrd",
-                            machine_get_initrd, machine_set_initrd, NULL);
-    object_property_set_description(obj, "initrd",
-                                    "Linux initial ramdisk file",
-                                    NULL);
-    object_property_add_str(obj, "append",
-                            machine_get_append, machine_set_append, NULL);
-    object_property_set_description(obj, "append",
-                                    "Linux kernel command line",
-                                    NULL);
-    object_property_add_str(obj, "dtb",
-                            machine_get_dtb, machine_set_dtb, NULL);
-    object_property_set_description(obj, "dtb",
-                                    "Linux kernel device tree file",
-                                    NULL);
-    object_property_add_str(obj, "dumpdtb",
-                            machine_get_dumpdtb, machine_set_dumpdtb, NULL);
-    object_property_set_description(obj, "dumpdtb",
-                                    "Dump current dtb to a file and quit",
-                                    NULL);
-    object_property_add(obj, "phandle-start", "int",
-                        machine_get_phandle_start,
-                        machine_set_phandle_start,
-                        NULL, NULL, NULL);
-    object_property_set_description(obj, "phandle-start",
-                                    "The first phandle ID we may generate dynamically",
-                                    NULL);
-    object_property_add_str(obj, "dt-compatible",
-                            machine_get_dt_compatible,
-                            machine_set_dt_compatible,
-                            NULL);
-    object_property_set_description(obj, "dt-compatible",
-                                    "Overrides the \"compatible\" property of the dt root node",
-                                    NULL);
-    object_property_add_bool(obj, "dump-guest-core",
-                             machine_get_dump_guest_core,
-                             machine_set_dump_guest_core,
-                             NULL);
-    object_property_set_description(obj, "dump-guest-core",
-                                    "Include guest memory in  a core dump",
-                                    NULL);
-    object_property_add_bool(obj, "mem-merge",
-                             machine_get_mem_merge,
-                             machine_set_mem_merge, NULL);
-    object_property_set_description(obj, "mem-merge",
-                                    "Enable/disable memory merge support",
-                                    NULL);
-    object_property_add_bool(obj, "usb",
-                             machine_get_usb,
-                             machine_set_usb, NULL);
-    object_property_set_description(obj, "usb",
-                                    "Set on/off to enable/disable usb",
-                                    NULL);
-    object_property_add_str(obj, "firmware",
-                            machine_get_firmware,
-                            machine_set_firmware, NULL);
-    object_property_set_description(obj, "firmware",
-                                    "Firmware image",
-                                    NULL);
-    object_property_add_bool(obj, "iommu",
-                             machine_get_iommu,
-                             machine_set_iommu, NULL);
-    object_property_set_description(obj, "iommu",
-                                    "Set on/off to enable/disable Intel IOMMU (VT-d)",
-                                    NULL);
-    object_property_add_bool(obj, "suppress-vmdesc",
-                             machine_get_suppress_vmdesc,
-                             machine_set_suppress_vmdesc, NULL);
-    object_property_set_description(obj, "suppress-vmdesc",
-                                    "Set on to disable self-describing migration",
-                                    NULL);
-
     /* Register notifier when init is done for sysbus sanity checks */
     ms->sysbus_notifier.notify = machine_init_notify;
     qemu_add_machine_init_done_notifier(&ms->sysbus_notifier);
-- 
2.4.3

  parent reply	other threads:[~2015-08-26 12:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-26 12:03 [Qemu-devel] [PATCH RFC 0/7] Making QOM introspectable Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 1/7] qom: allow properties to be registered against classes Daniel P. Berrange
2015-09-02 16:18   ` Andreas Färber
2015-09-03 15:49     ` Daniel P. Berrange
2015-09-03 16:37       ` Markus Armbruster
2015-09-03 16:41         ` Andreas Färber
2015-09-03 17:02           ` Markus Armbruster
2015-09-03 17:09             ` Daniel P. Berrange
2015-09-03 17:21               ` Andreas Färber
2015-09-03 17:25                 ` Daniel P. Berrange
2015-09-04  6:56                   ` Markus Armbruster
2015-09-07 12:54                     ` Paolo Bonzini
2015-09-11 16:09     ` Daniel P. Berrange
2015-09-04 21:38   ` Marc-André Lureau
2015-09-07  8:46     ` Daniel P. Berrange
2015-09-07 13:11       ` Andreas Färber
2015-09-07 13:17         ` Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 2/7] hostmem: register properties against the class instead of object Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 3/7] rng: " Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 4/7] tpm: " Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 5/7] cpu: avoid using object instance state in property getter Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 6/7] x86-cpu: register properties against the class instead of object Daniel P. Berrange
2015-08-26 12:03 ` Daniel P. Berrange [this message]
2015-09-02  9:05 ` [Qemu-devel] [PATCH RFC 0/7] Making QOM introspectable Daniel P. Berrange
2015-09-02 11:14   ` Markus Armbruster
2015-09-02 16:16   ` Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440590594-5514-8-git-send-email-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).