* [Qemu-devel] Win32 MinGW build with current CVS @ 2006-08-02 18:07 Andreas Bollhalder 2006-08-02 19:07 ` NyOS 0 siblings, 1 reply; 6+ messages in thread From: Andreas Bollhalder @ 2006-08-02 18:07 UTC (permalink / raw) To: qemu-devel -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello It seems that the aio support broke my MinGW build batch under Win32. Is it suposed to work on WIN32 ? Any ideas ? Andreas gcc -Wall -O2 -g -fno-strict-aliasing -fomit-frame-pointer -I. -I.. - -I/D/DEV/QEMU/qemu/target-i386 -I/D/DEV/QEMU/qemu -D_GNU_SOURCE - -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/D/DEV/QEMU/qemu/fpu - -DHAS_AUDIO -I/D/DEV/QEMU/qemu/slirp -c -o block-raw.o /D/DEV/QEMU/qemu/block-raw.c d:/DEV/QEMU/qemu/block-raw.c: In function `raw_open': d:/DEV/QEMU/qemu/block-raw.c:573: `BDRV_O_CREATE' undeclared (first use in this function) d:/DEV/QEMU/qemu/block-raw.c:573: (Each undeclared identifier is reported only once d:/DEV/QEMU/qemu/block-raw.c:573: for each function it appears in.) d:/DEV/QEMU/qemu/block-raw.c: In function `raw_aio_new': d:/DEV/QEMU/qemu/block-raw.c:635: structure has no member named `hevent' d:/DEV/QEMU/qemu/block-raw.c:636: structure has no member named `hevent' d:/DEV/QEMU/qemu/block-raw.c: In function `raw_aio_cb': d:/DEV/QEMU/qemu/block-raw.c:643: `acb1' undeclared (first use in this function) d:/DEV/QEMU/qemu/block-raw.c:648: `s' undeclared (first use in this function) d:/DEV/QEMU/qemu/block-raw.c: In function `raw_aio_read': d:/DEV/QEMU/qemu/block-raw.c:662: warning: unused variable `ret_count' d:/DEV/QEMU/qemu/block-raw.c: In function `raw_aio_write': d:/DEV/QEMU/qemu/block-raw.c:685: warning: unused variable `ret_count' d:/DEV/QEMU/qemu/block-raw.c: In function `raw_truncate': d:/DEV/QEMU/qemu/block-raw.c:737: `length' undeclared (first use in this function) d:/DEV/QEMU/qemu/vl.h: At top level: d:/DEV/QEMU/qemu/block-raw.c:627: warning: `raw_aio_new' defined but not used d:/DEV/QEMU/qemu/block-raw.c:658: warning: `raw_aio_read' defined but not used d:/DEV/QEMU/qemu/block-raw.c:681: warning: `raw_aio_write' defined but not used d:/DEV/QEMU/qemu/block-raw.c:714: warning: `raw_aio_delete' defined but not used make: *** [block-raw.o] Error 1 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFE0OnykyKr2gmercERAq3gAJ9hX0tp0/uqCCUrUy1ctCyVih71twCgjRi+ ys2Km+sxRKMZSTPRux+yCi8= =DDwp -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Win32 MinGW build with current CVS 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 0 siblings, 1 reply; 6+ messages in thread From: NyOS @ 2006-08-02 19:07 UTC (permalink / raw) To: qemu-devel On Wed, 02 Aug 2006 20:07:46 +0200, Andreas Bollhalder <bolle@geodb.org> wrote: > Hello > > It seems that the aio support broke my MinGW build batch under Win32. Is > it suposed to work on WIN32 ? > > Any ideas ? > > Andreas ... Hi! "Kernel Asynchronous I/O (AIO) Support for Linux Overview AIO enables even a single application thread to overlap I/O operations with other processing, by providing an interface for submitting one or more I/O requests in one system call (io_submit()) without waiting for completion, and a separate interface (io_getevents()) to reap completed I/O operations associated with a given completion group. Support for kernel AIO has been included in the 2.6 Linux kernel." source: http://lse.sourceforge.net/io/aio.html So, I don't think so. But please correct me, if I'm wrong. Nyos ------------------------------------------------------- Delay not, Caesar. Read it instantly. -- Shakespeare, "Julius Caesar" 3,1 Here is a letter, read it at your leisure. -- Shakespeare, "Merchant of Venice" 5,1 [Quoted in "VMS Internals and Data Structures", V4.4, when referring to I/O system services.] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Win32 MinGW build with current CVS 2006-08-02 19:07 ` NyOS @ 2006-08-03 3:14 ` Kazu 2006-08-03 8:24 ` Kazu 0 siblings, 1 reply; 6+ messages in thread From: Kazu @ 2006-08-03 3:14 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 1001 bytes --] Sent: Thursday, August 03, 2006 4:07 AM NyOS wrote: On Wed, 02 Aug 2006 20:07:46 +0200, Andreas Bollhalder <bolle@geodb.org> wrote: >> Hello >> >> It seems that the aio support broke my MinGW build batch under Win32. Is >> it suposed to work on WIN32 ? >> >> Any ideas ? >> >> Andreas ... >Support for kernel AIO has been included in the 2.6 Linux kernel." source: http://lse.sourceforge.net/io/aio.html >So, I don't think so. But please correct me, if I'm wrong. 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. Regards, Kazu [-- Attachment #2: qemu-20060803-aio.patch --] [-- Type: application/octet-stream, Size: 2598 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 03:01:51 -0000 @@ -518,7 +518,6 @@ #else /* _WIN32 */ /* XXX: use another file ? */ -#include <windows.h> #include <winioctl.h> typedef struct BDRVRawState { @@ -632,18 +631,17 @@ 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 +658,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 +674,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 +698,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 +711,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 03:01:53 -0000 @@ -46,6 +46,7 @@ #endif #ifdef _WIN32 +#define WINVER 0x0500 #include <windows.h> #define fsync _commit #define lseek _lseeki64 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Win32 MinGW build with current CVS 2006-08-03 3:14 ` Kazu @ 2006-08-03 8:24 ` Kazu 0 siblings, 0 replies; 6+ messages in thread From: Kazu @ 2006-08-03 8:24 UTC (permalink / raw) To: qemu-devel [-- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [Qemu-devel] Win32 MinGW build with current CVS
@ 2006-08-03 8:41 ZIGLIO, Frediano, VF-IT
0 siblings, 0 replies; 6+ messages in thread
From: ZIGLIO, Frediano, VF-IT @ 2006-08-03 8:41 UTC (permalink / raw)
To: qemu-devel
> From:
> qemu-devel-bounces+frediano.ziglio=vodafone.com@nongnu.org
> [mailto:qemu-devel-bounces+frediano.ziglio=vodafone.com@nongnu
> .org] On Behalf Of Kazu
> Sent: giovedì 3 agosto 2006 10.25
> To: qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] Win32 MinGW build with current CVS
>
> 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
>
Please use GetFileSize using second parameter instead of defining WINVER to 0x0500. GetFileSize support 64-bit...
bye
Frediano
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [Qemu-devel] Win32 MinGW build with current CVS
@ 2006-08-03 8:58 ZIGLIO, Frediano, VF-IT
0 siblings, 0 replies; 6+ messages in thread
From: ZIGLIO, Frediano, VF-IT @ 2006-08-03 8:58 UTC (permalink / raw)
To: qemu-devel
>
> 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
>
Well, consider this code, it define a pGetFileSizeEx you can use instead
of GetFileSizeEx
---------- header ----------
extern BOOL (WINAPI *pGetFileSizeEx)(HANDLE hFile, PLARGE_INTEGER
lpFileSize);
---------- header ----------
---------- code ----------
#define STRICT
#include <windows.h>
static BOOL WINAPI
autoGetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize);
typedef BOOL (WINAPI *tGetFileSizeEx)(HANDLE hFile, PLARGE_INTEGER
lpFileSize);
tGetFileSizeEx pGetFileSizeEx = autoGetFileSizeEx;
// replacement that automatically load proper api
static BOOL WINAPI
oldGetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize)
{
DWORD dwHigh;
DWORD res = GetFileSize(hFile, &dwHigh);
if (res != 0xFFFFFFFF || GetLastError() == NO_ERROR) {
lpFileSize->LowPart = res;
lpFileSize->HighPart = dwHigh;
return TRUE;
}
return FALSE;
}
// replacement that automatically load proper api
static BOOL WINAPI
autoGetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize)
{
tGetFileSizeEx proc = (tGetFileSizeEx)
GetProcAddress(GetModuleHandle("kernel32"), "GetFileSizeEx");
pGetFileSizeEx = proc ? proc : oldGetFileSizeEx;
return pGetFileSizeEx(hFile, lpFileSize);
}
---------- code ----------
Frediano
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-08-03 8:58 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 -- 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
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).