From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KVSRe-0001A5-LL for qemu-devel@nongnu.org; Tue, 19 Aug 2008 10:44:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KVSRd-00019m-LG for qemu-devel@nongnu.org; Tue, 19 Aug 2008 10:44:25 -0400 Received: from [199.232.76.173] (port=48371 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVSRd-00019j-Gh for qemu-devel@nongnu.org; Tue, 19 Aug 2008 10:44:25 -0400 Received: from savannah.gnu.org ([199.232.41.3]:38967 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KVSRd-0006j9-NW for qemu-devel@nongnu.org; Tue, 19 Aug 2008 10:44:25 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KVSRb-0006vm-CG for qemu-devel@nongnu.org; Tue, 19 Aug 2008 14:44:23 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KVSRa-0006vi-SH for qemu-devel@nongnu.org; Tue, 19 Aug 2008 14:44:23 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Tue, 19 Aug 2008 14:44:22 +0000 Subject: [Qemu-devel] [5028] Revert r4979 since it breaks the monitor Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5028 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5028 Author: aliguori Date: 2008-08-19 14:44:22 +0000 (Tue, 19 Aug 2008) Log Message: ----------- Revert r4979 since it breaks the monitor Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/console.h trunk/monitor.c trunk/vl.c Modified: trunk/console.h =================================================================== --- trunk/console.h 2008-08-19 13:14:17 UTC (rev 5027) +++ trunk/console.h 2008-08-19 14:44:22 UTC (rev 5028) @@ -160,7 +160,6 @@ does not need to include console.h */ /* monitor.c */ void monitor_init(CharDriverState *hd, int show_banner); -void monitor_start_input(void); void term_puts(const char *str); void term_vprintf(const char *fmt, va_list ap); void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); Modified: trunk/monitor.c =================================================================== --- trunk/monitor.c 2008-08-19 13:14:17 UTC (rev 5027) +++ trunk/monitor.c 2008-08-19 14:44:22 UTC (rev 5028) @@ -76,6 +76,8 @@ static uint8_t term_outbuf[1024]; static int term_outbuf_index; +static void monitor_start_input(void); + CPUState *mon_cpu = NULL; void term_flush(void) @@ -2683,13 +2685,15 @@ readline_handle_byte(buf[i]); } +static void monitor_start_input(void); + static void monitor_handle_command1(void *opaque, const char *cmdline) { monitor_handle_command(cmdline); monitor_start_input(); } -void monitor_start_input(void) +static void monitor_start_input(void) { readline_start("(qemu) ", 0, monitor_handle_command1, NULL); } @@ -2730,6 +2734,8 @@ hide_banner = !show_banner; qemu_chr_add_handlers(hd, term_can_read, term_read, term_event, NULL); + + readline_start("", 0, monitor_handle_command1, NULL); } /* XXX: use threads ? */ Modified: trunk/vl.c =================================================================== --- trunk/vl.c 2008-08-19 13:14:17 UTC (rev 5027) +++ trunk/vl.c 2008-08-19 14:44:22 UTC (rev 5028) @@ -5721,7 +5721,7 @@ bdrv_flags |= BDRV_O_SNAPSHOT; if (!cache) bdrv_flags |= BDRV_O_DIRECT; - if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0) { + if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0 || qemu_key_check(bdrv, file)) { fprintf(stderr, "qemu: could not open disk image %s\n", file); return -1; @@ -8009,14 +8009,22 @@ return -EPERM; } +static BlockDriverState *get_bdrv(int index) +{ + if (index > nb_drives) + return NULL; + return drives_table[index].bdrv; +} + static void read_passwords(void) { BlockDriverState *bs; int i; - for(i = 0; i < nb_drives; i++) { - bs = drives_table[i].bdrv; - qemu_key_check(bs, bdrv_get_device_name(bs)); + for(i = 0; i < 6; i++) { + bs = get_bdrv(i); + if (bs) + qemu_key_check(bs, bdrv_get_device_name(bs)); } } @@ -8185,7 +8193,6 @@ int optind; const char *r, *optarg; CharDriverState *monitor_hd; - int has_monitor; const char *monitor_device; const char *serial_devices[MAX_SERIAL_PORTS]; int serial_device_index; @@ -9055,8 +9062,6 @@ } /* Maintain compatibility with multiple stdio monitors */ - - has_monitor = 0; if (!strcmp(monitor_device,"stdio")) { for (i = 0; i < MAX_SERIAL_PORTS; i++) { const char *devname = serial_devices[i]; @@ -9069,7 +9074,6 @@ break; } } - has_monitor = 1; } if (monitor_device) { monitor_hd = qemu_chr_open(monitor_device); @@ -9078,7 +9082,6 @@ exit(1); } monitor_init(monitor_hd, !nographic); - has_monitor = 1; } for(i = 0; i < MAX_SERIAL_PORTS; i++) { @@ -9139,16 +9142,12 @@ } #endif - read_passwords(); - - if (has_monitor) - monitor_start_input(); - if (loadvm) do_loadvm(loadvm); { /* XXX: simplify init */ + read_passwords(); if (autostart) { vm_start(); }