qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 11/12] cmdline: implement -nodefaults with qemuopts
Date: Tue, 20 Mar 2012 09:01:37 +0100	[thread overview]
Message-ID: <1332230498-20684-12-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1332230498-20684-1-git-send-email-pbonzini@redhat.com>

This becomes -machine default_devices.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-config.c |    4 ++++
 vl.c          |   40 ++++++++++++++++++----------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/qemu-config.c b/qemu-config.c
index f5cf56b..6e97ff6 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -560,6 +560,10 @@ static QemuOptsList qemu_machine_opts = {
             .type = QEMU_OPT_STRING,
             .help = "accelerator list",
         }, {
+            .name = "default_devices",
+            .type = QEMU_OPT_BOOL,
+            .help = "create default devices",
+        }, {
             .name = "autostart",
             .type = QEMU_OPT_BOOL,
             .help = "start machine immediately",
diff --git a/vl.c b/vl.c
index b485f4c..aa324ed 100644
--- a/vl.c
+++ b/vl.c
@@ -3075,15 +3075,7 @@ int main(int argc, char **argv, char **envp)
                 incoming = optarg;
                 break;
             case QEMU_OPTION_nodefaults:
-                default_serial = 0;
-                default_parallel = 0;
-                default_virtcon = 0;
-                default_monitor = 0;
-                default_net = 0;
-                default_floppy = 0;
-                default_cdrom = 0;
-                default_sdcard = 0;
-                default_vga = 0;
+                qemu_opts_set(qemu_find_opts("machine"), 0, "default_devices", "off");
                 break;
             case QEMU_OPTION_xen_domid:
                 if (!(xen_available())) {
@@ -3243,26 +3235,30 @@ int main(int argc, char **argv, char **envp)
                                machine->default_machine_opts, 0);
     }
 
-    qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NULL, 0);
-    qemu_opts_foreach(qemu_find_opts("global"), default_driver_check, NULL, 0);
+    if (qemu_opt_get_bool(machine_opts, "default_devices", true)) {
+        qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NULL, 0);
+        qemu_opts_foreach(qemu_find_opts("global"), default_driver_check, NULL, 0);
+
+        default_serial &= !machine->no_serial;
+        default_parallel &= !machine->no_parallel;
+        default_virtcon &= machine->use_virtcon;
+        default_floppy &= !machine->no_floppy;
+        default_cdrom &= !machine->no_cdrom;
+        default_sdcard &= !machine->no_sdcard;
 
-    if (machine->no_serial) {
+        /* No need for machine->no_vga.  Boards can simply ignore the
+         * vga_interface_type variable (most will, indeed).
+         */
+    } else {
         default_serial = 0;
-    }
-    if (machine->no_parallel) {
         default_parallel = 0;
-    }
-    if (!machine->use_virtcon) {
         default_virtcon = 0;
-    }
-    if (machine->no_floppy) {
+        default_monitor = 0;
+        default_net = 0;
         default_floppy = 0;
-    }
-    if (machine->no_cdrom) {
         default_cdrom = 0;
-    }
-    if (machine->no_sdcard) {
         default_sdcard = 0;
+        default_vga = 0;
     }
 
     if (display_type == DT_NOGRAPHIC) {
-- 
1.7.7.6

  parent reply	other threads:[~2012-03-20  8:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-20  8:01 [Qemu-devel] [PATCH 00/12] convert many options to QemuOpts Paolo Bonzini
2012-03-20  8:01 ` [Qemu-devel] [PATCH 01/12] vga: disable default VGA if appropriate -device is used Paolo Bonzini
2012-03-20  8:01 ` [Qemu-devel] [PATCH 02/12] QemuOpts: use strtosz Paolo Bonzini
2012-03-20  8:01 ` [Qemu-devel] [PATCH 03/12] cmdline: implement -m with QemuOpts Paolo Bonzini
2012-03-20  8:01 ` [Qemu-devel] [PATCH 04/12] cmdline: implement -S " Paolo Bonzini
2012-03-20  8:01 ` [Qemu-devel] [PATCH 05/12] cmdline: implement -bios " Paolo Bonzini
2012-03-20  8:01 ` [Qemu-devel] [PATCH 06/12] cmdline: implement -localtime " Paolo Bonzini
2012-03-20  8:01 ` [Qemu-devel] [PATCH 07/12] cmdline: make -M a simple alias for -machine type Paolo Bonzini
2012-03-20  8:01 ` [Qemu-devel] [PATCH 08/12] cmdline: convert -smp to QemuOpts Paolo Bonzini
2012-03-20  8:01 ` [Qemu-devel] [PATCH 09/12] cmdline: reindent numa_add Paolo Bonzini
2012-03-20  8:01 ` [Qemu-devel] [PATCH 10/12] cmdline: convert -numa to QemuOpts Paolo Bonzini
2012-03-20  8:01 ` Paolo Bonzini [this message]
2012-03-20  8:01 ` [Qemu-devel] [PATCH 12/12] cmdline: convert -no-shutdown and -no-reboot " Paolo Bonzini
2012-03-20  9:04   ` Peter Maydell
2012-03-20  9:15     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332230498-20684-12-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).