Blob Blame History Raw
From d07eaace8b57fc37cd83b958c7242d15024ee945 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Tue, 6 Aug 2013 13:17:02 +0200
Subject: [PATCH 09/28] vl: New qemu_get_machine_opts()

RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <1375795025-28674-4-git-send-email-armbru@redhat.com>
Patchwork-id: 52991
O-Subject: [PATCH 7.0 qemu-kvm 3/6] vl: New qemu_get_machine_opts()
Bugzilla: 980782
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Michal Novotny <minovotn@redhat.com>
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>

To be used in the next few commits to fix or clean up queries of
"machine" options (-machine and its sugared forms).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372943363-24081-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 7f9d6e540ec4f3bf4dc3501c4a1405998c2be4e7)
---
 include/sysemu/sysemu.h |  2 ++
 vl.c                    | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 include/sysemu/sysemu.h |    2 ++
 vl.c                    |   19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index b5e1add..3caeb66 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -185,6 +185,8 @@ char *get_boot_devices_list(size_t *size);
 
 DeviceState *get_boot_device(uint32_t position);
 
+QemuOpts *qemu_get_machine_opts(void);
+
 bool usb_enabled(bool default_usb);
 
 extern QemuOptsList qemu_drive_opts;
diff --git a/vl.c b/vl.c
index b8a7f18..fe58eff 100644
--- a/vl.c
+++ b/vl.c
@@ -518,6 +518,25 @@ static QemuOptsList qemu_realtime_opts = {
     },
 };
 
+/**
+ * Get machine options
+ *
+ * Returns: machine options (never null).
+ */
+QemuOpts *qemu_get_machine_opts(void)
+{
+    QemuOptsList *list;
+    QemuOpts *opts;
+
+    list = qemu_find_opts("machine");
+    assert(list);
+    opts = qemu_opts_find(list, NULL);
+    if (!opts) {
+        opts = qemu_opts_create_nofail(list);
+    }
+    return opts;
+}
+
 const char *qemu_get_vm_name(void)
 {
     return qemu_name;
-- 
1.7.1