From: "Kazu" <kazoo@r3.dion.ne.jp>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Win32 MinGW build with current CVS
Date: Thu, 3 Aug 2006 17:24:52 +0900 [thread overview]
Message-ID: <001201c6b6d6$4b708640$0464a8c0@athlon> (raw)
In-Reply-To: 001d01c6b6aa$e931ac00$0464a8c0@athlon
[-- Attachment #1: Type: text/plain, Size: 675 bytes --]
Sent: Thursday, August 03, 2006 12:14 PM Kazu wrote:
>
> Asynchronous I/O is implemented by overlapped I/O for Win32 but it is not
> enabled.
>
> I tried to make the program. A patch attached fixs compile errors.
>
> I found some problems about it.
> GetFileSizeEx needs to define WINVER 0x0500. It means that Windows 98/Me
> host is not supported.
> If we try to support Win 98/Me host, it is necessary to change configure
to
> use --enable-win9x and make another binary, etc.
>
> The first attempt to open a hard disk image with a drive letter always
> failed. After the second time is OK.
>
An attached patch fixes the bug which is first time read error.
Regards,
Kazu
[-- Attachment #2: qemu-20060803-aio-2.patch --]
[-- Type: application/octet-stream, Size: 3777 bytes --]
Index: block-raw.c
===================================================================
RCS file: /sources/qemu/qemu/block-raw.c,v
retrieving revision 1.2
diff -u -r1.2 block-raw.c
--- block-raw.c 2 Aug 2006 22:02:08 -0000 1.2
+++ block-raw.c 3 Aug 2006 08:16:58 -0000
@@ -518,7 +518,6 @@
#else /* _WIN32 */
/* XXX: use another file ? */
-#include <windows.h>
#include <winioctl.h>
typedef struct BDRVRawState {
@@ -600,12 +599,14 @@
memset(&ov, 0, sizeof(ov));
ov.Offset = offset;
ov.OffsetHigh = offset >> 32;
- ret = ReadFile(s->hfile, buf, count, NULL, &ov);
- if (!ret)
- return -EIO;
- ret = GetOverlappedResult(s->hfile, &ov, &ret_count, TRUE);
- if (!ret)
- return -EIO;
+ ret = ReadFile(s->hfile, buf, count, &ret_count, &ov);
+ if (!ret) {
+ ret = GetOverlappedResult(s->hfile, &ov, &ret_count, TRUE);
+ if (!ret)
+ return -EIO;
+ else
+ return ret_count;
+ }
return ret_count;
}
@@ -620,30 +621,31 @@
memset(&ov, 0, sizeof(ov));
ov.Offset = offset;
ov.OffsetHigh = offset >> 32;
- ret = WriteFile(s->hfile, buf, count, NULL, &ov);
- if (!ret)
- return -EIO;
- ret = GetOverlappedResult(s->hfile, &ov, &ret_count, TRUE);
- if (!ret)
- return -EIO;
+ ret = WriteFile(s->hfile, buf, count, &ret_count, &ov);
+ if (!ret) {
+ ret = GetOverlappedResult(s->hfile, &ov, &ret_count, TRUE);
+ if (!ret)
+ return -EIO;
+ else
+ return ret_count;
+ }
return ret_count;
}
static int raw_aio_new(BlockDriverAIOCB *acb)
{
RawAIOCB *acb1;
- BDRVRawState *s = acb->bs->opaque;
acb1 = qemu_mallocz(sizeof(RawAIOCB));
if (!acb1)
return -ENOMEM;
acb->opaque = acb1;
- s->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- if (!s->hEvent)
+ acb1->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ if (!acb1->hEvent)
return -ENOMEM;
return 0;
}
-
+#ifndef QEMU_TOOL
static void raw_aio_cb(void *opaque)
{
BlockDriverAIOCB *acb = opaque;
@@ -660,7 +662,7 @@
acb->cb(acb->cb_opaque, 0);
}
}
-
+#endif
static int raw_aio_read(BlockDriverAIOCB *acb, int64_t sector_num,
uint8_t *buf, int nb_sectors)
{
@@ -676,7 +678,9 @@
acb1->ov.OffsetHigh = offset >> 32;
acb1->ov.hEvent = acb1->hEvent;
acb1->count = nb_sectors * 512;
+#ifndef QEMU_TOOL
qemu_add_wait_object(acb1->ov.hEvent, raw_aio_cb, acb);
+#endif
ret = ReadFile(s->hfile, buf, acb1->count, NULL, &acb1->ov);
if (!ret)
return -EIO;
@@ -698,7 +702,9 @@
acb1->ov.OffsetHigh = offset >> 32;
acb1->ov.hEvent = acb1->hEvent;
acb1->count = nb_sectors * 512;
+#ifndef QEMU_TOOL
qemu_add_wait_object(acb1->ov.hEvent, raw_aio_cb, acb);
+#endif
ret = ReadFile(s->hfile, buf, acb1->count, NULL, &acb1->ov);
if (!ret)
return -EIO;
@@ -709,9 +715,11 @@
{
BlockDriverState *bs = acb->bs;
BDRVRawState *s = bs->opaque;
+#ifndef QEMU_TOOL
RawAIOCB *acb1 = acb->opaque;
qemu_del_wait_object(acb1->ov.hEvent, raw_aio_cb, acb);
+#endif
/* XXX: if more than one async I/O it is not correct */
CancelIo(s->hfile);
}
Index: vl.h
===================================================================
RCS file: /sources/qemu/qemu/vl.h,v
retrieving revision 1.137
diff -u -r1.137 vl.h
--- vl.h 1 Aug 2006 16:21:11 -0000 1.137
+++ vl.h 3 Aug 2006 08:17:00 -0000
@@ -46,6 +46,7 @@
#endif
#ifdef _WIN32
+#define WINVER 0x0500
#include <windows.h>
#define fsync _commit
#define lseek _lseeki64
next prev parent reply other threads:[~2006-08-03 8:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-02 18:07 [Qemu-devel] Win32 MinGW build with current CVS Andreas Bollhalder
2006-08-02 19:07 ` NyOS
2006-08-03 3:14 ` Kazu
2006-08-03 8:24 ` Kazu [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-08-03 8:41 ZIGLIO, Frediano, VF-IT
2006-08-03 8:58 ZIGLIO, Frediano, VF-IT
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001201c6b6d6$4b708640$0464a8c0@athlon' \
--to=kazoo@r3.dion.ne.jp \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).