qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 1/4] vl.c: generalise qemu_get_machine_opts()


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 1/4] vl.c: generalise qemu_get_machine_opts()
Date: Fri, 18 Apr 2014 00:53:40 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

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 <address@hidden>
---

 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]