From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lr0OE-0003mu-2O for qemu-devel@nongnu.org; Mon, 06 Apr 2009 21:46:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lr0O9-0003lC-GY for qemu-devel@nongnu.org; Mon, 06 Apr 2009 21:46:13 -0400 Received: from [199.232.76.173] (port=57985 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lr0O9-0003l0-6O for qemu-devel@nongnu.org; Mon, 06 Apr 2009 21:46:09 -0400 Received: from e4.ny.us.ibm.com ([32.97.182.144]:32950) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lr0O8-0006lQ-O4 for qemu-devel@nongnu.org; Mon, 06 Apr 2009 21:46:09 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e4.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n371gnX2019346 for ; Mon, 6 Apr 2009 21:42:49 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n371k78r187406 for ; Mon, 6 Apr 2009 21:46:07 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n371iULJ024105 for ; Mon, 6 Apr 2009 21:44:30 -0400 Received: from squirrel.codemonkey.ws (sig-9-65-87-20.mts.ibm.com [9.65.87.20]) by d01av02.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n371iTf6024059 for ; Mon, 6 Apr 2009 21:44:30 -0400 Message-ID: <49DAB05E.5020906@us.ibm.com> Date: Mon, 06 Apr 2009 20:46:06 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] r6677 broke access to physical FDD on Win32 References: <49C16D71.7020104@bttr-software.de> <49C41240.8030102@codemonkey.ws> <68676e00903211507o79e84b73j79d63dd03b7750f2@mail.gmail.com> In-Reply-To: <68676e00903211507o79e84b73j79d63dd03b7750f2@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 Luca Tettamanti wrote: > On Fri, Mar 20, 2009 at 11:01 PM, Anthony Liguori wrote: > >> Robert Riebisch wrote: >> >>> Hi! >>> >>> If I run QEMU on Win32 with option "-fda a:", then I'm unable to access >>> physical floppies from guest OS. "Physical" also includes virtual drives >>> created by . >>> >>> I'm also unable to boot such floppies ("-boot a"). Error message is: >>> "Boot failed: not a bootable floppy disk" >>> >>> By doing some builds I narrowed the problem down to >>> by >>> Anthony Liguori. >>> >>> >> I suspect this code: >> >> block-raw-win32.c:raw_getlength(): >> >> case FTYPE_HARDDISK: >> status = DeviceIoControl(s->hfile, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, >> NULL, 0, &dg, sizeof(dg), &count, NULL); >> if (status != 0) { >> l = dg.DiskSize; >> } >> break; >> >> Is not doing the correct thing. >> > > Sort of; the real problem is in find_device_type(), it thinks that the > device is a file :S > > The bug is here: > type = GetDriveType(s->drive_path); > if (type == DRIVE_CDROM) > return FTYPE_CD; > else > return FTYPE_FILE; > > GetDriveType("a:") returns DRIVE_REMOVABLE, which according to MSDN > means "The drive has removable media; for example, a floppy drive, > thumb drive, or flash card reader."; the code is not expecting such a > value so it sets the type to FTYPE_FILE; raw_getlength() then uses > GetFileSize() which of course fails... > > Here's a patch for properly handling the return value of GetDriveType > (sorry for the attachment, but I'm currently using a remote VM over > RDP and don't have a decent mailer installed). > > Luca > Applied. Thanks. -- Regards, Anthony Liguori