From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G8YVl-0007jw-T4 for qemu-devel@nongnu.org; Thu, 03 Aug 2006 04:24:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G8YVk-0007iQ-Aa for qemu-devel@nongnu.org; Thu, 03 Aug 2006 04:24:57 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G8YVj-0007iD-Qa for qemu-devel@nongnu.org; Thu, 03 Aug 2006 04:24:55 -0400 Received: from [211.5.2.73] (helo=nm01omta015.dion.ne.jp) by monty-python.gnu.org with smtp (Exim 4.52) id 1G8YZ1-00058W-Nl for qemu-devel@nongnu.org; Thu, 03 Aug 2006 04:28:20 -0400 Message-ID: <001201c6b6d6$4b708640$0464a8c0@athlon> From: "Kazu" References: <44D0E9F2.1090202@geodb.org> <001d01c6b6aa$e931ac00$0464a8c0@athlon> Subject: Re: [Qemu-devel] Win32 MinGW build with current CVS Date: Thu, 3 Aug 2006 17:24:52 +0900 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_000F_01C6B721.BB1C84D0" 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 This is a multi-part message in MIME format. ------=_NextPart_000_000F_01C6B721.BB1C84D0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit 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 ------=_NextPart_000_000F_01C6B721.BB1C84D0 Content-Type: application/octet-stream; name="qemu-20060803-aio-2.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="qemu-20060803-aio-2.patch" Index: block-raw.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /sources/qemu/qemu/block-raw.c,v=0A= retrieving revision 1.2=0A= diff -u -r1.2 block-raw.c=0A= --- block-raw.c 2 Aug 2006 22:02:08 -0000 1.2=0A= +++ block-raw.c 3 Aug 2006 08:16:58 -0000=0A= @@ -518,7 +518,6 @@=0A= #else /* _WIN32 */=0A= =0A= /* XXX: use another file ? */=0A= -#include =0A= #include =0A= =0A= typedef struct BDRVRawState {=0A= @@ -600,12 +599,14 @@=0A= memset(&ov, 0, sizeof(ov));=0A= ov.Offset =3D offset;=0A= ov.OffsetHigh =3D offset >> 32;=0A= - ret =3D ReadFile(s->hfile, buf, count, NULL, &ov);=0A= - if (!ret)=0A= - return -EIO;=0A= - ret =3D GetOverlappedResult(s->hfile, &ov, &ret_count, TRUE);=0A= - if (!ret)=0A= - return -EIO;=0A= + ret =3D ReadFile(s->hfile, buf, count, &ret_count, &ov);=0A= + if (!ret) {=0A= + ret =3D GetOverlappedResult(s->hfile, &ov, &ret_count, TRUE);=0A= + if (!ret)=0A= + return -EIO;=0A= + else=0A= + return ret_count;=0A= + }=0A= return ret_count;=0A= }=0A= =0A= @@ -620,30 +621,31 @@=0A= memset(&ov, 0, sizeof(ov));=0A= ov.Offset =3D offset;=0A= ov.OffsetHigh =3D offset >> 32;=0A= - ret =3D WriteFile(s->hfile, buf, count, NULL, &ov);=0A= - if (!ret)=0A= - return -EIO;=0A= - ret =3D GetOverlappedResult(s->hfile, &ov, &ret_count, TRUE);=0A= - if (!ret)=0A= - return -EIO;=0A= + ret =3D WriteFile(s->hfile, buf, count, &ret_count, &ov);=0A= + if (!ret) {=0A= + ret =3D GetOverlappedResult(s->hfile, &ov, &ret_count, TRUE);=0A= + if (!ret)=0A= + return -EIO;=0A= + else=0A= + return ret_count;=0A= + }=0A= return ret_count;=0A= }=0A= =0A= static int raw_aio_new(BlockDriverAIOCB *acb)=0A= {=0A= RawAIOCB *acb1;=0A= - BDRVRawState *s =3D acb->bs->opaque;=0A= =0A= acb1 =3D qemu_mallocz(sizeof(RawAIOCB));=0A= if (!acb1)=0A= return -ENOMEM;=0A= acb->opaque =3D acb1;=0A= - s->hEvent =3D CreateEvent(NULL, TRUE, FALSE, NULL);=0A= - if (!s->hEvent)=0A= + acb1->hEvent =3D CreateEvent(NULL, TRUE, FALSE, NULL);=0A= + if (!acb1->hEvent)=0A= return -ENOMEM;=0A= return 0;=0A= }=0A= -=0A= +#ifndef QEMU_TOOL=0A= static void raw_aio_cb(void *opaque)=0A= {=0A= BlockDriverAIOCB *acb =3D opaque;=0A= @@ -660,7 +662,7 @@=0A= acb->cb(acb->cb_opaque, 0);=0A= }=0A= }=0A= -=0A= +#endif=0A= static int raw_aio_read(BlockDriverAIOCB *acb, int64_t sector_num, =0A= uint8_t *buf, int nb_sectors)=0A= {=0A= @@ -676,7 +678,9 @@=0A= acb1->ov.OffsetHigh =3D offset >> 32;=0A= acb1->ov.hEvent =3D acb1->hEvent;=0A= acb1->count =3D nb_sectors * 512;=0A= +#ifndef QEMU_TOOL=0A= qemu_add_wait_object(acb1->ov.hEvent, raw_aio_cb, acb);=0A= +#endif=0A= ret =3D ReadFile(s->hfile, buf, acb1->count, NULL, &acb1->ov);=0A= if (!ret)=0A= return -EIO;=0A= @@ -698,7 +702,9 @@=0A= acb1->ov.OffsetHigh =3D offset >> 32;=0A= acb1->ov.hEvent =3D acb1->hEvent;=0A= acb1->count =3D nb_sectors * 512;=0A= +#ifndef QEMU_TOOL=0A= qemu_add_wait_object(acb1->ov.hEvent, raw_aio_cb, acb);=0A= +#endif=0A= ret =3D ReadFile(s->hfile, buf, acb1->count, NULL, &acb1->ov);=0A= if (!ret)=0A= return -EIO;=0A= @@ -709,9 +715,11 @@=0A= {=0A= BlockDriverState *bs =3D acb->bs;=0A= BDRVRawState *s =3D bs->opaque;=0A= +#ifndef QEMU_TOOL=0A= RawAIOCB *acb1 =3D acb->opaque;=0A= =0A= qemu_del_wait_object(acb1->ov.hEvent, raw_aio_cb, acb);=0A= +#endif=0A= /* XXX: if more than one async I/O it is not correct */=0A= CancelIo(s->hfile);=0A= }=0A= Index: vl.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /sources/qemu/qemu/vl.h,v=0A= retrieving revision 1.137=0A= diff -u -r1.137 vl.h=0A= --- vl.h 1 Aug 2006 16:21:11 -0000 1.137=0A= +++ vl.h 3 Aug 2006 08:17:00 -0000=0A= @@ -46,6 +46,7 @@=0A= #endif=0A= =0A= #ifdef _WIN32=0A= +#define WINVER 0x0500=0A= #include =0A= #define fsync _commit=0A= #define lseek _lseeki64=0A= ------=_NextPart_000_000F_01C6B721.BB1C84D0--