9ae3a8
From d07eaace8b57fc37cd83b958c7242d15024ee945 Mon Sep 17 00:00:00 2001
9ae3a8
From: Markus Armbruster <armbru@redhat.com>
9ae3a8
Date: Tue, 6 Aug 2013 13:17:02 +0200
9ae3a8
Subject: [PATCH 09/28] vl: New qemu_get_machine_opts()
9ae3a8
9ae3a8
RH-Author: Markus Armbruster <armbru@redhat.com>
9ae3a8
Message-id: <1375795025-28674-4-git-send-email-armbru@redhat.com>
9ae3a8
Patchwork-id: 52991
9ae3a8
O-Subject: [PATCH 7.0 qemu-kvm 3/6] vl: New qemu_get_machine_opts()
9ae3a8
Bugzilla: 980782
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
9ae3a8
9ae3a8
To be used in the next few commits to fix or clean up queries of
9ae3a8
"machine" options (-machine and its sugared forms).
9ae3a8
9ae3a8
Signed-off-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
Message-id: 1372943363-24081-4-git-send-email-armbru@redhat.com
9ae3a8
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9ae3a8
(cherry picked from commit 7f9d6e540ec4f3bf4dc3501c4a1405998c2be4e7)
9ae3a8
---
9ae3a8
 include/sysemu/sysemu.h |  2 ++
9ae3a8
 vl.c                    | 19 +++++++++++++++++++
9ae3a8
 2 files changed, 21 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 include/sysemu/sysemu.h |    2 ++
9ae3a8
 vl.c                    |   19 +++++++++++++++++++
9ae3a8
 2 files changed, 21 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
9ae3a8
index b5e1add..3caeb66 100644
9ae3a8
--- a/include/sysemu/sysemu.h
9ae3a8
+++ b/include/sysemu/sysemu.h
9ae3a8
@@ -185,6 +185,8 @@ char *get_boot_devices_list(size_t *size);
9ae3a8
 
9ae3a8
 DeviceState *get_boot_device(uint32_t position);
9ae3a8
 
9ae3a8
+QemuOpts *qemu_get_machine_opts(void);
9ae3a8
+
9ae3a8
 bool usb_enabled(bool default_usb);
9ae3a8
 
9ae3a8
 extern QemuOptsList qemu_drive_opts;
9ae3a8
diff --git a/vl.c b/vl.c
9ae3a8
index b8a7f18..fe58eff 100644
9ae3a8
--- a/vl.c
9ae3a8
+++ b/vl.c
9ae3a8
@@ -518,6 +518,25 @@ static QemuOptsList qemu_realtime_opts = {
9ae3a8
     },
9ae3a8
 };
9ae3a8
 
9ae3a8
+/**
9ae3a8
+ * Get machine options
9ae3a8
+ *
9ae3a8
+ * Returns: machine options (never null).
9ae3a8
+ */
9ae3a8
+QemuOpts *qemu_get_machine_opts(void)
9ae3a8
+{
9ae3a8
+    QemuOptsList *list;
9ae3a8
+    QemuOpts *opts;
9ae3a8
+
9ae3a8
+    list = qemu_find_opts("machine");
9ae3a8
+    assert(list);
9ae3a8
+    opts = qemu_opts_find(list, NULL);
9ae3a8
+    if (!opts) {
9ae3a8
+        opts = qemu_opts_create_nofail(list);
9ae3a8
+    }
9ae3a8
+    return opts;
9ae3a8
+}
9ae3a8
+
9ae3a8
 const char *qemu_get_vm_name(void)
9ae3a8
 {
9ae3a8
     return qemu_name;
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8