* [Qemu-devel] mingw compile error patch
@ 2006-08-22 0:24 alex
2006-08-22 4:22 ` Kazu
0 siblings, 1 reply; 5+ messages in thread
From: alex @ 2006-08-22 0:24 UTC (permalink / raw)
To: qemu-devel
Hi,
The patch below allows me to compile qemu on Windows, however it is still
not working.
The program exits immediately reporting that it can't open the hard disk
image.
GDB reports the offensive pies of code is in malloc(), which does not make
sense to me.
Am I doing something wrong?
qemu_mallocz (size=2680) at c:/qemu/osdep.c:190
190 ptr = qemu_malloc(size);
(gdb)
188 {
(gdb)
190 ptr = qemu_malloc(size);
(gdb)
qemu_malloc (size=2680) at c:/qemu/osdep.c:56
56 return malloc(size);
(gdb)
Program exited with code 01.
(gdb) where
(gdb) No stack.
---------patch------------
RCS file: /sources/qemu/qemu/block-raw.c,v
retrieving revision 1.7
diff -r1.7 block-raw.c
821a822,823
> static int find_cdrom(char *cdrom_name, int cdrom_name_size);
> static int find_device_type(const char *filename);
1095c1097
< LARGE_INTEGER l;
---
> ULARGE_INTEGER l;
1098c1100
< switch(s->ftype) {
---
> switch(s->type) {
1185c1187
< memset(drives, 0, sizeof(drivers));
---
> memset(drives, 0, sizeof(drives));
1204c1206
<
---
> char drive_letter[2];
1207,1209c1209,1211
< s->drive_letter[0] = p[0];
< s->drive_letter[1] = '\0';
< type = GetDriveType(s->drive_letter);
---
> drive_letter[0] = p[0];
> drive_letter[1] = '\0';
> type = GetDriveType(drive_letter);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] mingw compile error patch
2006-08-22 0:24 [Qemu-devel] mingw compile error patch alex
@ 2006-08-22 4:22 ` Kazu
2006-08-22 5:18 ` [Qemu-devel] " Alex
0 siblings, 1 reply; 5+ messages in thread
From: Kazu @ 2006-08-22 4:22 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 470 bytes --]
alex wrote:
> Hi,
> The patch below allows me to compile qemu on Windows, however it is still
> not working.
> The program exits immediately reporting that it can't open the hard disk
> image.
> GDB reports the offensive pies of code is in malloc(), which does not make
> sense to me.
> Am I doing something wrong?
>
An attached patch fixes compile error for win32.
It also fixes using /dev/cdrom and a file name with a drive letter.
Qcow is not fixed.
Regards,
Kazu
[-- Attachment #2: qemu-20060821-compile.patch --]
[-- Type: application/octet-stream, Size: 4301 bytes --]
Index: block-raw.c
===================================================================
RCS file: /sources/qemu/qemu/block-raw.c,v
retrieving revision 1.7
diff -u -r1.7 block-raw.c
--- block-raw.c 19 Aug 2006 11:45:59 -0000 1.7
+++ block-raw.c 21 Aug 2006 00:48:38 -0000
@@ -871,13 +871,15 @@
NULL, 0, NULL, 0, &returned, NULL);
}
+static int find_cdrom(char *cdrom_name, int cdrom_name_size);
+static int find_device_type(BlockDriverState *bs, const char *filename);
+
static int raw_open(BlockDriverState *bs, const char *filename, int flags)
{
BDRVRawState *s = bs->opaque;
int access_flags, create_flags;
DWORD overlapped;
char device_name[64];
- const char *p;
if (strstart(filename, "/dev/cdrom", NULL)) {
if (find_cdrom(device_name, sizeof(device_name)) < 0)
@@ -892,7 +894,7 @@
filename = device_name;
}
}
- s->type = find_device_type(filename);
+ s->type = find_device_type(bs, filename);
if ((flags & BDRV_O_ACCESS) == O_RDWR) {
access_flags = GENERIC_READ | GENERIC_WRITE;
@@ -1095,7 +1097,7 @@
LARGE_INTEGER l;
ULARGE_INTEGER available, total, total_free;
- switch(s->ftype) {
+ switch(s->type) {
case FTYPE_FILE:
l.LowPart = GetFileSize(s->hfile, &l.HighPart);
if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
@@ -1104,7 +1106,7 @@
case FTYPE_CD:
if (!GetDiskFreeSpaceEx(s->drive_letter, &available, &total, &total_free))
return -EIO;
- l = total;
+ l.QuadPart = total.QuadPart;
break;
default:
return -EIO;
@@ -1182,7 +1184,7 @@
char drives[256], *pdrv = drives;
UINT type;
- memset(drives, 0, sizeof(drivers));
+ memset(drives, 0, sizeof(drives));
GetLogicalDriveStrings(sizeof(drives), drives);
while(pdrv[0] != '\0') {
type = GetDriveType(pdrv);
@@ -1197,16 +1199,19 @@
return -1;
}
-static int find_device_type(const char *filename)
+static int find_device_type(BlockDriverState *bs, const char *filename)
{
+ BDRVRawState *s = bs->opaque;
UINT type;
const char *p;
+ char root_path[4];
if (strstart(filename, "\\\\.\\", &p) ||
strstart(filename, "//./", &p)) {
s->drive_letter[0] = p[0];
s->drive_letter[1] = '\0';
- type = GetDriveType(s->drive_letter);
+ snprintf(root_path, sizeof(root_path), "%c:\\", p[0]);
+ type = GetDriveType(root_path);
if (type == DRIVE_CDROM)
return FTYPE_CD;
else
@@ -1222,7 +1227,6 @@
int access_flags, create_flags;
DWORD overlapped;
char device_name[64];
- const char *p;
if (strstart(filename, "/dev/cdrom", NULL)) {
if (find_cdrom(device_name, sizeof(device_name)) < 0)
@@ -1237,7 +1241,7 @@
filename = device_name;
}
}
- s->type = find_device_type(filename);
+ s->type = find_device_type(bs, filename);
if ((flags & BDRV_O_ACCESS) == O_RDWR) {
access_flags = GENERIC_READ | GENERIC_WRITE;
Index: block.c
===================================================================
RCS file: /sources/qemu/qemu/block.c,v
retrieving revision 1.34
diff -u -r1.34 block.c
--- block.c 19 Aug 2006 11:45:59 -0000 1.34
+++ block.c 21 Aug 2006 00:48:41 -0000
@@ -182,11 +182,18 @@
#endif
#ifdef _WIN32
-static int is_windows_drive(const char *filename)
+static int is_windows_file(const char *filename)
{
if (((filename[0] >= 'a' && filename[0] <= 'z') ||
(filename[0] >= 'A' && filename[0] <= 'Z')) &&
- filename[1] == ':' && filename[2] == '\0')
+ filename[1] == ':')
+ return 1;
+ return 0;
+}
+
+static int is_windows_drive(const char *filename)
+{
+ if (is_windows_file(filename) && filename[2] == '\0')
return 1;
if (strstart(filename, "\\\\.\\", NULL) ||
strstart(filename, "//./", NULL))
@@ -205,6 +212,8 @@
#ifdef _WIN32
if (is_windows_drive(filename))
return &bdrv_raw;
+ if (is_windows_file(filename))
+ return &bdrv_raw;
#endif
p = strchr(filename, ':');
if (!p)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: mingw compile error patch
2006-08-22 4:22 ` Kazu
@ 2006-08-22 5:18 ` Alex
2006-08-22 7:45 ` Kazu
0 siblings, 1 reply; 5+ messages in thread
From: Alex @ 2006-08-22 5:18 UTC (permalink / raw)
To: qemu-devel
That's better. What's wrong with QCOW?
--
Alex.
"Kazu" <kazoo@r3.dion.ne.jp> wrote in message
news:001401c6c5a2$84edab20$0464a8c0@athlon...
> alex wrote:
>
>> Hi,
>> The patch below allows me to compile qemu on Windows, however it is still
>> not working.
>> The program exits immediately reporting that it can't open the hard disk
>> image.
>> GDB reports the offensive pies of code is in malloc(), which does not
>> make
>> sense to me.
>> Am I doing something wrong?
>>
>
> An attached patch fixes compile error for win32.
> It also fixes using /dev/cdrom and a file name with a drive letter.
> Qcow is not fixed.
>
> Regards,
> Kazu
>
--------------------------------------------------------------------------------
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] Re: mingw compile error patch
2006-08-22 5:18 ` [Qemu-devel] " Alex
@ 2006-08-22 7:45 ` Kazu
2006-08-23 16:01 ` [Qemu-devel] " alex
0 siblings, 1 reply; 5+ messages in thread
From: Kazu @ 2006-08-22 7:45 UTC (permalink / raw)
To: qemu-devel
Alex wrote:
> That's better. What's wrong with QCOW?
>
Qcow uses aio interface but aio emulation is not fully implemented.
Regards,
Kazu
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: Re: mingw compile error patch
2006-08-22 7:45 ` Kazu
@ 2006-08-23 16:01 ` alex
0 siblings, 0 replies; 5+ messages in thread
From: alex @ 2006-08-23 16:01 UTC (permalink / raw)
To: qemu-devel
Is anybody actively working on that?
Any hints of what should be done to make it work?
Looking at the code, I see that qemu_aio_init, qemu_aio_poll,
qemu_aio_wait_start, qemu_aio_wait, and qemu_aio_wait_end
under _WIN32 have empty bodies. Is this intentional or what should happen
there?
"Kazu" <kazoo@r3.dion.ne.jp> wrote in message
news:000c01c6c5be$fdffdda0$0464a8c0@athlon...
> Alex wrote:
>
> > That's better. What's wrong with QCOW?
> >
>
> Qcow uses aio interface but aio emulation is not fully implemented.
>
> Regards,
> Kazu
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-08-23 16:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-22 0:24 [Qemu-devel] mingw compile error patch alex
2006-08-22 4:22 ` Kazu
2006-08-22 5:18 ` [Qemu-devel] " Alex
2006-08-22 7:45 ` Kazu
2006-08-23 16:01 ` [Qemu-devel] " alex
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).