yeahuh / rpms / qemu-kvm

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