aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-02-22 21:50:10 +0100
committerAndreas Färber <afaerber@suse.de>2013-02-25 22:04:44 +0100
commitc0ce02f54fae7338be6bfb4cdead5d8786628cf5 (patch)
treeab3f6bf7303774453ab48f41f470cad96c2000ab
parente2074f761556ef68038ae785876b97a973f31a30 (diff)
cpu: Introduce cpu_class_set_vmsd()
This setter avoids redefining each VMStateDescription value to vmstate_dummy by not referencing the value for CONFIG_USER_ONLY. Suggested-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r--include/qom/cpu.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 1106e39255..65e24d3eee 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -135,6 +135,23 @@ void cpu_reset(CPUState *cpu);
ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model);
/**
+ * cpu_class_set_vmsd:
+ * @cc: CPU class
+ * @value: Value to set.
+ *
+ * Sets #VMStateDescription for @cc.
+ */
+#ifndef CONFIG_USER_ONLY
+static inline void cpu_class_set_vmsd(CPUClass *cc,
+ const struct VMStateDescription *value)
+{
+ cc->vmsd = value;
+}
+#else
+#define cpu_class_set_vmsd(cpu, val) ((cpu)->vmsd = NULL)
+#endif
+
+/**
* qemu_cpu_has_work:
* @cpu: The vCPU to check.
*