qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] r6677 broke access to physical FDD on Win32


From: Anthony Liguori
Subject: Re: [Qemu-devel] r6677 broke access to physical FDD on Win32
Date: Sun, 22 Mar 2009 21:20:56 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090320)

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
(<http://www.bttr-software.de/forum/forum_entry.php?id=6249>):

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]