Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Is2an-0003WE-2h for mharc-grub-devel@gnu.org; Tue, 13 Nov 2007 15:42:41 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Is2al-0003TP-DO for grub-devel@gnu.org; Tue, 13 Nov 2007 15:42:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Is2ak-0003RN-EZ for grub-devel@gnu.org; Tue, 13 Nov 2007 15:42:39 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Is2ak-0003RG-B4 for grub-devel@gnu.org; Tue, 13 Nov 2007 15:42:38 -0500 Received: from mailout11.sul.t-online.de ([194.25.134.85] helo=mailout11.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Is2aj-0002ns-Pn for grub-devel@gnu.org; Tue, 13 Nov 2007 15:42:38 -0500 Received: from fwd28.aul.t-online.de by mailout11.aul.t-online.de with smtp id 1Is2ai-00011K-00; Tue, 13 Nov 2007 21:42:36 +0100 Received: from [10.3.2.2] (bRejkMZvghmf209Rg0nkEx8IICBe+mP+yrOFsx5DKeo00zIaPmbrsVFDoIusASswcp@[217.235.235.141]) by fwd28.aul.t-online.de with esmtp id 1Is2aW-0NAmXY0; Tue, 13 Nov 2007 21:42:24 +0100 Message-ID: <473A0C32.5000001@t-online.de> Date: Tue, 13 Nov 2007 21:42:26 +0100 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 MIME-Version: 1.0 To: grub-devel@gnu.org Content-Type: multipart/mixed; boundary="------------050900030602050903040906" X-ID: bRejkMZvghmf209Rg0nkEx8IICBe+mP+yrOFsx5DKeo00zIaPmbrsVFDoIusASswcp X-TOI-MSGID: b8ebffa9-1bf7-4541-8753-cb16052f1cea X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: [PATCH] mkdevicemap for Cygwin X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2007 20:42:39 -0000 This is a multi-part message in MIME format. --------------050900030602050903040906 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Some changes for grub-mkdevicemap on Cygwin. Christian 2007-11-13 Christian Franke * util/grub-mkdevicemap.c (get_floppy_disk_name): Add Cygwin device names. (get_ide_disk_name): Disable on __CYGWIN__. (get_scsi_disk_name): Add Cygwin device names. (check_device): Add static. Return error instead of success on empty string. (make_device_map): Disable IDE loop on __CYGWIN__. Move label inside linux specific code to prevent compiler warning. --------------050900030602050903040906 Content-Type: text/x-patch; name="grub2-mkdevicemap-Cygwin.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-mkdevicemap-Cygwin.patch" --- grub2.orig/util/grub-mkdevicemap.c 2007-08-28 12:18:10.000000000 +0200 +++ grub2/util/grub-mkdevicemap.c 2007-11-13 21:27:18.265625000 +0100 @@ -166,6 +166,9 @@ get_floppy_disk_name (char *name, int un #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. */ @@ -173,6 +176,7 @@ get_floppy_disk_name (char *name, int un #endif } +#ifndef __CYGWIN__ static void get_ide_disk_name (char *name, int unit) { @@ -213,6 +217,7 @@ get_ide_disk_name (char *name, int unit) *name = 0; #endif } +#endif /* __CYGWIN__ */ static void get_scsi_disk_name (char *name, int unit) @@ -248,6 +253,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. */ @@ -277,16 +285,16 @@ get_i2o_disk_name (char *name, char unit /* Check if DEVICE can be read. If an error occurs, return zero, otherwise return non-zero. */ -int +static int 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) { @@ -415,7 +423,8 @@ make_device_map (const char *device_map, goto finish; } #endif /* __linux__ */ - + +#ifndef __CYGWIN__ /* IDE disks. */ for (i = 0; i < 8; i++) { @@ -431,6 +440,7 @@ make_device_map (const char *device_map, num_hd++; } } +#endif /* __CYGWIN__ */ #ifdef __linux__ /* ATARAID disks. */ @@ -513,9 +523,10 @@ make_device_map (const char *device_map, } } } -#endif /* __linux__ */ finish: +#endif /* __linux__ */ + if (fp != stdout) fclose (fp); } --------------050900030602050903040906--