]> git.proxmox.com Git - mirror_qemu.git/commitdiff
cpu: Introduce device_class_set_vmsd() helper
authorAndreas Färber <afaerber@suse.de>
Tue, 18 Jun 2013 00:23:36 +0000 (02:23 +0200)
committerAndreas Färber <afaerber@suse.de>
Fri, 28 Jun 2013 11:25:11 +0000 (13:25 +0200)
It's the equivalent to cpu_class_set_vmsd(), to assign
DeviceClass::vmsd. It wasn't needed before since only static,
unmigratable VMStateDescriptions were assigned so far.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
include/qom/cpu.h

index 55a85c1a7d2a43f68a0fedb88827522e960b9c8a..397219b560eff1dd6788e807d9a68d888dfdee2c 100644 (file)
@@ -238,6 +238,27 @@ static inline void cpu_class_set_vmsd(CPUClass *cc,
 #define cpu_class_set_vmsd(cc, value) ((cc)->vmsd = NULL)
 #endif
 
+/**
+ * device_class_set_vmsd:
+ * @dc: Device class
+ * @value: Value to set. Unused for %CONFIG_USER_ONLY.
+ *
+ * Sets #VMStateDescription for @dc.
+ *
+ * The @value argument is intentionally discarded for the non-softmmu targets
+ * to avoid linker errors or excessive preprocessor usage. If this behavior
+ * is undesired, you should assign #DeviceClass.vmsd directly instead.
+ */
+#ifndef CONFIG_USER_ONLY
+static inline void device_class_set_vmsd(DeviceClass *dc,
+                                         const struct VMStateDescription *value)
+{
+    dc->vmsd = value;
+}
+#else
+#define device_class_set_vmsd(dc, value) ((dc)->vmsd = NULL)
+#endif
+
 /**
  * qemu_cpu_has_work:
  * @cpu: The vCPU to check.