aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-06-18 02:23:36 +0200
committerAndreas Färber <afaerber@suse.de>2013-06-28 13:25:11 +0200
commit19e3835cffbcae37ade8c3abcc4525895f7b528a (patch)
tree2bb4c485187d2231458dbb83c094e2971dabd5e8
parent76d5f0294a744fa6786683760aa33e2b7fae6d8f (diff)
cpu: Introduce device_class_set_vmsd() helper
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>
-rw-r--r--include/qom/cpu.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 55a85c1a7d..397219b560 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -239,6 +239,27 @@ static inline void cpu_class_set_vmsd(CPUClass *cc,
#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.
*