* [Qemu-devel] [PATCH] Fix compilation with Cygwin
@ 2007-12-13 7:42 Hervé Poussineau
0 siblings, 0 replies; 2+ messages in thread
From: Hervé Poussineau @ 2007-12-13 7:42 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 148 bytes --]
Hi,
Cygwin compiler doesn't seem to like variables/structure members which are
named "interface".
This patch renames them to "type".
Hervé
[-- Attachment #2: cygwin_fix.diff --]
[-- Type: application/octet-stream, Size: 5046 bytes --]
Index: sysemu.h
===================================================================
RCS file: /cvsroot/qemu/qemu/sysemu.h,v
retrieving revision 1.2
diff -u -r1.2 sysemu.h
--- sysemu.h 2 Dec 2007 04:51:08 -0000 1.2
+++ sysemu.h 13 Dec 2007 07:28:36 -0000
@@ -122,7 +122,7 @@
typedef struct DriveInfo {
BlockDriverState *bdrv;
- BlockInterfaceType interface;
+ BlockInterfaceType type;
int bus;
int unit;
} DriveInfo;
@@ -134,8 +134,8 @@
int nb_drives;
DriveInfo drives_table[MAX_DRIVES+1];
-extern int drive_get_index(BlockInterfaceType interface, int bus, int unit);
-extern int drive_get_max_bus(BlockInterfaceType interface);
+extern int drive_get_index(BlockInterfaceType type, int bus, int unit);
+extern int drive_get_max_bus(BlockInterfaceType type);
/* serial ports */
Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.379
diff -u -r1.379 vl.c
--- vl.c 11 Dec 2007 23:23:51 -0000 1.379
+++ vl.c 13 Dec 2007 07:31:37 -0000
@@ -4811,14 +4811,14 @@
return nb_drives_opt++;
}
-int drive_get_index(BlockInterfaceType interface, int bus, int unit)
+int drive_get_index(BlockInterfaceType type, int bus, int unit)
{
int index;
/* seek interface, bus and unit */
for (index = 0; index < nb_drives; index++)
- if (drives_table[index].interface == interface &&
+ if (drives_table[index].type == type &&
drives_table[index].bus == bus &&
drives_table[index].unit == unit)
return index;
@@ -4826,14 +4826,14 @@
return -1;
}
-int drive_get_max_bus(BlockInterfaceType interface)
+int drive_get_max_bus(BlockInterfaceType type)
{
int max_bus;
int index;
max_bus = -1;
for (index = 0; index < nb_drives; index++) {
- if(drives_table[index].interface == interface &&
+ if(drives_table[index].type == type &&
drives_table[index].bus > max_bus)
max_bus = drives_table[index].bus;
}
@@ -4846,7 +4846,7 @@
char file[1024];
char devname[128];
const char *mediastr = "";
- BlockInterfaceType interface;
+ BlockInterfaceType type;
enum { MEDIA_DISK, MEDIA_CDROM } media;
int bus_id, unit_id;
int cyls, heads, secs, translation;
@@ -4875,11 +4875,11 @@
!strcmp(machine->name, "SS-600MP") ||
!strcmp(machine->name, "versatilepb") ||
!strcmp(machine->name, "versatileab")) {
- interface = IF_SCSI;
+ type = IF_SCSI;
max_devs = MAX_SCSI_DEVS;
strcpy(devname, "scsi");
} else {
- interface = IF_IDE;
+ type = IF_IDE;
max_devs = MAX_IDE_DEVS;
strcpy(devname, "ide");
}
@@ -4906,22 +4906,22 @@
if (get_param_value(buf, sizeof(buf), "if", str)) {
strncpy(devname, buf, sizeof(devname));
if (!strcmp(buf, "ide")) {
- interface = IF_IDE;
+ type = IF_IDE;
max_devs = MAX_IDE_DEVS;
} else if (!strcmp(buf, "scsi")) {
- interface = IF_SCSI;
+ type = IF_SCSI;
max_devs = MAX_SCSI_DEVS;
} else if (!strcmp(buf, "floppy")) {
- interface = IF_FLOPPY;
+ type = IF_FLOPPY;
max_devs = 0;
} else if (!strcmp(buf, "pflash")) {
- interface = IF_PFLASH;
+ type = IF_PFLASH;
max_devs = 0;
} else if (!strcmp(buf, "mtd")) {
- interface = IF_MTD;
+ type = IF_MTD;
max_devs = 0;
} else if (!strcmp(buf, "sd")) {
- interface = IF_SD;
+ type = IF_SD;
max_devs = 0;
} else {
fprintf(stderr, "qemu: '%s' unsupported bus type '%s'\n", str, buf);
@@ -5036,7 +5036,7 @@
if (unit_id == -1) {
unit_id = 0;
- while (drive_get_index(interface, bus_id, unit_id) != -1) {
+ while (drive_get_index(type, bus_id, unit_id) != -1) {
unit_id++;
if (max_devs && unit_id >= max_devs) {
unit_id -= max_devs;
@@ -5057,23 +5057,23 @@
* ignore multiple definitions
*/
- if (drive_get_index(interface, bus_id, unit_id) != -1)
+ if (drive_get_index(type, bus_id, unit_id) != -1)
return 0;
/* init */
- if (interface == IF_IDE || interface == IF_SCSI)
+ if (type == IF_IDE || type == IF_SCSI)
mediastr = (media == MEDIA_CDROM) ? "-cd" : "-hd";
snprintf(buf, sizeof(buf), max_devs ? "%1$s%4$i%2$s%3$i" : "%s%s%i",
devname, mediastr, unit_id, bus_id);
bdrv = bdrv_new(buf);
drives_table[nb_drives].bdrv = bdrv;
- drives_table[nb_drives].interface = interface;
+ drives_table[nb_drives].type = type;
drives_table[nb_drives].bus = bus_id;
drives_table[nb_drives].unit = unit_id;
nb_drives++;
- switch(interface) {
+ switch(type) {
case IF_IDE:
case IF_SCSI:
switch(media) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix compilation with Cygwin
@ 2007-12-13 12:58 Balazs Attila-Mihaly (Cd-MaN)
0 siblings, 0 replies; 2+ messages in thread
From: Balazs Attila-Mihaly (Cd-MaN) @ 2007-12-13 12:58 UTC (permalink / raw)
To: qemu-devel; +Cc: hpoussin
I just want to confirm that the fix works also for MinGW. At first I dind't like the word "type" and would have preferred something like "if_type", but I realized that drives[i].type is just as readable as drives[i].if_type.
----- Original Message ----
From: Hervé Poussineau <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Sent: Thursday, 13 December, 2007 9:42:07 AM
Subject: [Qemu-devel] [PATCH] Fix compilation with Cygwin
Hi,
Cygwin compiler doesn't seem to like variables/structure members which
are
named "interface".
This patch renames them to "type".
Hervé
__________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-13 12:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-13 7:42 [Qemu-devel] [PATCH] Fix compilation with Cygwin Hervé Poussineau
-- strict thread matches above, loose matches on Subject: below --
2007-12-13 12:58 Balazs Attila-Mihaly (Cd-MaN)
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).