From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LlZmj-0004rE-Hp for qemu-devel@nongnu.org; Sun, 22 Mar 2009 22:21:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LlZme-0004qz-3b for qemu-devel@nongnu.org; Sun, 22 Mar 2009 22:21:04 -0400 Received: from [199.232.76.173] (port=39394 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LlZme-0004qw-0T for qemu-devel@nongnu.org; Sun, 22 Mar 2009 22:21:00 -0400 Received: from yx-out-1718.google.com ([74.125.44.157]:2637) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LlZmd-0006nv-NE for qemu-devel@nongnu.org; Sun, 22 Mar 2009 22:20:59 -0400 Received: by yx-out-1718.google.com with SMTP id 34so1123770yxf.82 for ; Sun, 22 Mar 2009 19:20:58 -0700 (PDT) Message-ID: <49C6F208.9080009@codemonkey.ws> Date: Sun, 22 Mar 2009 21:20:56 -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> <49C4177B.7080405@bttr-software.de> <49C42080.5080802@codemonkey.ws> <68676e00903201620n1ac29c01g9e3d7172f9bc69a4@mail.gmail.com> <49C4493E.9050701@codemonkey.ws> <49C6A459.3000409@bttr-software.de> In-Reply-To: <49C6A459.3000409@bttr-software.de> Content-Type: text/plain; charset=ISO-8859-1; 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 Robert Riebisch wrote: > Anthony Liguori wrote: > > >> Looks like the code is doing the right thing. Someone running windows >> is going to have to debug this because a: should be transformed to >> \\.\a: as far as I can read the code. >> > > Japheth posted the following proposal to my forum, where I advertize > running DOS in QEMU > (): > > I didn't test so far, because I was AFK for this weekend. > Needs a signed-off-by. Regards, Anthony Liguori > --- block-raw-win32.co Wed Mar 4 22:54:44 2009 > +++ block-raw-win32.c Sat Mar 21 05:51:34 2009 > @@ -32,6 +32,7 @@ > #define FTYPE_FILE 0 > #define FTYPE_CD 1 > #define FTYPE_HARDDISK 2 > +#define FTYPE_DISK 3 > > typedef struct BDRVRawState { > HANDLE hfile; > @@ -305,6 +306,7 @@ > if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR) > return -EIO; > break; > + case FTYPE_DISK: > case FTYPE_CD: > if (!GetDiskFreeSpaceEx(s->drive_path, &available, &total, > &total_free)) > return -EIO; > @@ -402,7 +404,7 @@ > if (type == DRIVE_CDROM) > return FTYPE_CD; > else > - return FTYPE_FILE; > + return FTYPE_DISK; > } else { > return FTYPE_FILE; > } > @@ -411,7 +413,7 @@ > static int hdev_open(BlockDriverState *bs, const char *filename, int flags) > { > BDRVRawState *s = bs->opaque; > - int access_flags, create_flags; > + int access_flags, create_flags, share_flags; > DWORD overlapped; > char device_name[64]; > > @@ -429,6 +431,10 @@ > } > } > s->type = find_device_type(bs, filename); > + if (s->type == FTYPE_DISK) > + share_flags = FILE_SHARE_READ | FILE_SHARE_WRITE; > + else > + share_flags = FILE_SHARE_READ; > > if ((flags & BDRV_O_ACCESS) == O_RDWR) { > access_flags = GENERIC_READ | GENERIC_WRITE; > @@ -447,7 +453,7 @@ > else if (!(flags & BDRV_O_CACHE_WB)) > overlapped |= FILE_FLAG_WRITE_THROUGH; > s->hfile = CreateFile(filename, access_flags, > - FILE_SHARE_READ, NULL, > + share_flags, NULL, > create_flags, overlapped, NULL); > if (s->hfile == INVALID_HANDLE_VALUE) { > int err = GetLastError(); > > Robert Riebisch >