Il 18/04/2014 00:25, Peter Crosthwaite ha scritto:
This "nofail" (i.e. does not return NULL) mechanism driving
qemu_get_machine_opts() does not need to be specific to machine opts
- its applicable to other types of opts. Generalise and re-implement
qemu_get_machine_opts() as a caller of the generalisation.
Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com>
---
vl.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/vl.c b/vl.c
index 9975e5a..bc12d0f 100644
--- a/vl.c
+++ b/vl.c
@@ -510,17 +510,12 @@ static QemuOptsList qemu_name_opts = {
},
};
-/**
- * Get machine options
- *
- * Returns: machine options (never null).
- */
-QemuOpts *qemu_get_machine_opts(void)
+static QemuOpts *qemu_get_opts_nofail(const char *type)
{
QemuOptsList *list;
QemuOpts *opts;
- list = qemu_find_opts("machine");
+ list = qemu_find_opts(type);
assert(list);
opts = qemu_opts_find(list, NULL);
if (!opts) {
@@ -529,6 +524,17 @@ QemuOpts *qemu_get_machine_opts(void)
return opts;
}
+/**
+ * Get machine options
+ *
+ * Returns: machine options (never null).
+ */
+
+QemuOpts *qemu_get_machine_opts(void)
+{
+ return qemu_get_opts_nofail("machine");
+}
+
const char *qemu_get_vm_name(void)
{
return qemu_name;
This is already planned for 2.1 as qemu_find_opts_singleton, which
either Igor or Hu will send.
Paolo