From 0fbb311786e9f6392ea7d49f36f4f9589f2c71ba Mon Sep 17 00:00:00 2001 From: chrfranke Date: Mon, 5 May 2008 20:58:53 +0000 Subject: [PATCH] 2008-05-05 Christian Franke * util/grub-mkdevicemap.c (get_floppy_disk_name) [__CYGWIN__]: Add Cygwin device names. (get_ide_disk_name) [__CYGWIN__]: Likewise. (get_scsi_disk_name) [__CYGWIN__]: Likewise. (check_device): Return error instead of success on empty name. (make_device_map): Move label inside linux specific code to prevent compiler warning. --- ChangeLog | 10 ++++++++++ util/grub-mkdevicemap.c | 17 ++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90a4284e6..640ed6fa6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-05-05 Christian Franke + + * util/grub-mkdevicemap.c (get_floppy_disk_name) [__CYGWIN__]: + Add Cygwin device names. + (get_ide_disk_name) [__CYGWIN__]: Likewise. + (get_scsi_disk_name) [__CYGWIN__]: Likewise. + (check_device): Return error instead of success on empty name. + (make_device_map): Move label inside linux specific code to + prevent compiler warning. + 2008-04-30 Robert Millan Based on patch from Fabian Greffrath diff --git a/util/grub-mkdevicemap.c b/util/grub-mkdevicemap.c index 5a33fdc78..174215efb 100644 --- a/util/grub-mkdevicemap.c +++ b/util/grub-mkdevicemap.c @@ -166,6 +166,9 @@ get_floppy_disk_name (char *name, int unit) #elif defined(__QNXNTO__) /* QNX RTP */ sprintf (name, "/dev/fd%d", unit); +#elif defined(__CYGWIN__) + /* Cygwin */ + sprintf (name, "/dev/fd%d", unit); #else # warning "BIOS floppy drives cannot be guessed in your operating system." /* Set NAME to a bogus string. */ @@ -207,6 +210,10 @@ get_ide_disk_name (char *name, int unit) /* Actually, QNX RTP doesn't distinguish IDE from SCSI, so this could contain SCSI disks. */ sprintf (name, "/dev/hd%d", unit); +#elif defined(__CYGWIN__) + /* Cygwin emulates all disks as /dev/sdX. */ + (void) unit; + *name = 0; #else # warning "BIOS IDE drives cannot be guessed in your operating system." /* Set NAME to a bogus string. */ @@ -248,6 +255,9 @@ get_scsi_disk_name (char *name, int unit) /* QNX RTP doesn't distinguish SCSI from IDE, so it is better to disable the detection of SCSI disks here. */ *name = 0; +#elif defined(__CYGWIN__) + /* Cygwin emulates all disks as /dev/sdX. */ + sprintf (name, "/dev/sd%c", unit + 'a'); #else # warning "BIOS SCSI drives cannot be guessed in your operating system." /* Set NAME to a bogus string. */ @@ -283,9 +293,9 @@ check_device (const char *device) char buf[512]; FILE *fp; - /* If DEVICE is empty, just return 1. */ + /* If DEVICE is empty, just return error. */ if (*device == 0) - return 1; + return 0; fp = fopen (device, "r"); if (! fp) @@ -513,9 +523,10 @@ make_device_map (const char *device_map, int floppy_disks) } } } -#endif /* __linux__ */ finish: +#endif /* __linux__ */ + if (fp != stdout) fclose (fp); }