From patchwork Mon Jun 7 23:52:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 54906 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by ozlabs.org (Postfix) with ESMTP id C26F8B7D43 for ; Tue, 8 Jun 2010 10:11:26 +1000 (EST) Received: from localhost ([127.0.0.1]:59119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLmKR-000393-NV for incoming@patchwork.ozlabs.org; Mon, 07 Jun 2010 20:06:03 -0400 Received: from [140.186.70.92] (port=43972 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLm7H-0004Or-AE for qemu-devel@nongnu.org; Mon, 07 Jun 2010 19:52:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OLm7E-0003B7-5R for qemu-devel@nongnu.org; Mon, 07 Jun 2010 19:52:27 -0400 Received: from e1.ny.us.ibm.com ([32.97.182.141]:37631) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLm7D-0003An-Vm for qemu-devel@nongnu.org; Mon, 07 Jun 2010 19:52:24 -0400 Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by e1.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o57NkTMj015395 for ; Mon, 7 Jun 2010 19:46:29 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o57NqN7p418018 for ; Mon, 7 Jun 2010 19:52:23 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o57NqMj1010413 for ; Mon, 7 Jun 2010 20:52:22 -0300 Received: from localhost.localdomain (sig-9-65-84-205.mts.ibm.com [9.65.84.205]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o57NqDr2009965; Mon, 7 Jun 2010 20:52:22 -0300 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Mon, 7 Jun 2010 18:52:01 -0500 Message-Id: <1275954730-8196-14-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1275954730-8196-1-git-send-email-aliguori@us.ibm.com> References: <1275954730-8196-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Glauber Costa , Anthony Liguori Subject: [Qemu-devel] [PATCH 13/22] machine: get rid of global default QEMUMachine members X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Right now, we have a lot of default device type options in the QEMUMachine structure. This is used by code within vl.c to determine whether it should add classes of devices (like serial). Really, vl.c has no business adding devices but all we need to do to support this is create common machine options to describe whether there are default devices of each class. vl.c can then use that to determine whether to add said devices. Signed-off-by: Anthony Liguori diff --git a/hw/boards.h b/hw/boards.h index e05637b..f33c44b 100644 --- a/hw/boards.h +++ b/hw/boards.h @@ -16,13 +16,6 @@ struct QEMUMachine { QEMUMachineInitFunc *init; int use_scsi; int max_cpus; - unsigned int no_serial:1, - no_parallel:1, - use_virtcon:1, - no_vga:1, - no_floppy:1, - no_cdrom:1, - no_sdcard:1; int is_default; QemuOptDesc *opts_desc; QemuOptValue *opts_default; @@ -43,29 +36,46 @@ extern QEMUMachine *current_machine; { \ .name = "driver", \ .type = QEMU_OPT_STRING, \ - }, \ - { \ + },{ \ .name = "ram_size", \ .type = QEMU_OPT_SIZE, \ },{ \ .name = "kernel", \ .type = QEMU_OPT_STRING, \ - }, \ - { \ + },{ \ .name = "cmdline", \ .type = QEMU_OPT_STRING, \ - }, \ - { \ + },{ \ .name = "initrd", \ .type = QEMU_OPT_STRING, \ - }, \ - { \ + },{ \ .name = "boot_device", \ .type = QEMU_OPT_STRING, \ - }, \ - { \ + },{ \ .name = "cpu", \ .type = QEMU_OPT_STRING, \ + },{ \ + .name = "serial", \ + .type = QEMU_OPT_BOOL, \ + },{ \ + .name = "parallel", \ + .type = QEMU_OPT_BOOL, \ + },{ \ + .name = "virtcon", \ + .type = QEMU_OPT_BOOL, \ + },{ \ + .name = "vga", \ + .type = QEMU_OPT_BOOL, \ + },{ \ + .name = "floppy", \ + .type = QEMU_OPT_BOOL, \ + },{ \ + .name = "cdrom", \ + .type = QEMU_OPT_BOOL, \ + },{ \ + .name = "sdcard", \ + .type = QEMU_OPT_BOOL, \ } + #endif diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c index 70b88df..e4d6ecd 100644 --- a/hw/s390-virtio.c +++ b/hw/s390-virtio.c @@ -273,9 +273,13 @@ static QEMUMachine s390_machine = { .alias = "s390", .desc = "VirtIO based S390 machine", .init = s390_init, - .no_serial = 1, - .no_parallel = 1, - .use_virtcon = 1, + .opts_default = (QemuOptValue[]) { + QOPT_VALUE("serial", "off"), + QOPT_VALUE("parallel", "off"), + QOPT_VALUE("virtcon", "on"), + QOPT_VALUE("vga", "off"), + { /* end of list */ } + }, .no_vga = 1, .max_cpus = 255, .is_default = 1, diff --git a/vl.c b/vl.c index 0a31a45..553da4d 100644 --- a/vl.c +++ b/vl.c @@ -3505,25 +3505,25 @@ int main(int argc, char **argv, char **envp) qemu_opts_foreach(&qemu_device_opts, default_driver_check, NULL, 0); qemu_opts_foreach(&qemu_global_opts, default_driver_check, NULL, 0); - if (machine->no_serial) { + if (!qemu_opt_get_bool(machine_opts, "serial", 1)) { default_serial = 0; } - if (machine->no_parallel) { + if (!qemu_opt_get_bool(machine_opts, "parallel", 1)) { default_parallel = 0; } - if (!machine->use_virtcon) { + if (!qemu_opt_get_bool(machine_opts, "virtcon", 0)) { default_virtcon = 0; } - if (machine->no_vga) { + if (!qemu_opt_get_bool(machine_opts, "vga", 1)) { default_vga = 0; } - if (machine->no_floppy) { + if (!qemu_opt_get_bool(machine_opts, "floppy", 1)) { default_floppy = 0; } - if (machine->no_cdrom) { + if (!qemu_opt_get_bool(machine_opts, "cdrom", 1)) { default_cdrom = 0; } - if (machine->no_sdcard) { + if (!qemu_opt_get_bool(machine_opts, "sdcard", 1)) { default_sdcard = 0; }