From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K95r1-00024t-Fb for qemu-devel@nongnu.org; Wed, 18 Jun 2008 18:10:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K95qz-00024P-Nx for qemu-devel@nongnu.org; Wed, 18 Jun 2008 18:10:10 -0400 Received: from [199.232.76.173] (port=46667 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K95qz-00024M-I6 for qemu-devel@nongnu.org; Wed, 18 Jun 2008 18:10:09 -0400 Received: from savannah.gnu.org ([199.232.41.3]:48280 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 1K95qz-0004En-6j for qemu-devel@nongnu.org; Wed, 18 Jun 2008 18:10:09 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1K95qu-0007ot-NO for qemu-devel@nongnu.org; Wed, 18 Jun 2008 22:10:04 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1K95qs-0007oC-L1 for qemu-devel@nongnu.org; Wed, 18 Jun 2008 22:10:03 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Wed, 18 Jun 2008 22:10:02 +0000 Subject: [Qemu-devel] [4747] Add image format option in monitor for removable media 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: 4747 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4747 Author: aurel32 Date: 2008-06-18 22:10:01 +0000 (Wed, 18 Jun 2008) Log Message: ----------- Add image format option in monitor for removable media (Chris Wright) CVE-2008-1945 Modified Paths: -------------- trunk/monitor.c Modified: trunk/monitor.c =================================================================== --- trunk/monitor.c 2008-06-18 09:32:32 UTC (rev 4746) +++ trunk/monitor.c 2008-06-18 22:10:01 UTC (rev 4747) @@ -396,18 +396,26 @@ eject_device(bs, force); } -static void do_change_block(const char *device, const char *filename) +static void do_change_block(const char *device, const char *filename, const char *fmt) { BlockDriverState *bs; + BlockDriver *drv = NULL; bs = bdrv_find(device); if (!bs) { term_printf("device not found\n"); return; } + if (fmt) { + drv = bdrv_find_format(fmt); + if (!drv) { + term_printf("invalid format %s\n", fmt); + return; + } + } if (eject_device(bs, 0) < 0) return; - bdrv_open(bs, filename, 0); + bdrv_open2(bs, filename, 0, drv); qemu_key_check(bs, filename); } @@ -426,12 +434,12 @@ } } -static void do_change(const char *device, const char *target) +static void do_change(const char *device, const char *target, const char *fmt) { if (strcmp(device, "vnc") == 0) { do_change_vnc(target); } else { - do_change_block(device, target); + do_change_block(device, target, fmt); } } @@ -1339,8 +1347,8 @@ "", "quit the emulator" }, { "eject", "-fB", do_eject, "[-f] device", "eject a removable medium (use -f to force it)" }, - { "change", "BF", do_change, - "device filename", "change a removable medium" }, + { "change", "BFs?", do_change, + "device filename [format]", "change a removable medium, optional format" }, { "screendump", "F", do_screen_dump, "filename", "save screen into PPM image 'filename'" }, { "logfile", "F", do_logfile,