From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1J8HND-00068z-U0 for mharc-grub-devel@gnu.org; Fri, 28 Dec 2007 10:43:47 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J8HNC-00068V-0t for grub-devel@gnu.org; Fri, 28 Dec 2007 10:43:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J8HN6-00063I-VD for grub-devel@gnu.org; Fri, 28 Dec 2007 10:43:45 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J8HN6-000632-EO for grub-devel@gnu.org; Fri, 28 Dec 2007 10:43:40 -0500 Received: from mailout02.sul.t-online.de ([194.25.134.17] helo=mailout02.aul.t-online.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J8HN6-0002PR-00 for grub-devel@gnu.org; Fri, 28 Dec 2007 10:43:40 -0500 Received: from fwd28.aul.t-online.de by mailout02.aul.t-online.de with smtp id 1J8HN4-00007x-02; Fri, 28 Dec 2007 16:43:38 +0100 Received: from [10.3.2.2] (VmIFb+ZUwhmoMfgZjXlNWFFqwZOGWO+EdEMbIBknISSiFDu-z9Ow+lYUgyTSjo5ZUB@[217.235.195.103]) by fwd28.aul.t-online.de with esmtp id 1J8HMg-02MI1A0; Fri, 28 Dec 2007 16:43:14 +0100 Message-ID: <47751992.9030008@t-online.de> Date: Fri, 28 Dec 2007 16:43:14 +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: The development of GRUB 2 References: <473A0C32.5000001@t-online.de> <20071206121504.GF13758@thorin> In-Reply-To: <20071206121504.GF13758@thorin> Content-Type: multipart/mixed; boundary="------------040306090002060801000303" X-ID: VmIFb+ZUwhmoMfgZjXlNWFFqwZOGWO+EdEMbIBknISSiFDu-z9Ow+lYUgyTSjo5ZUB X-TOI-MSGID: 8f679548-acd1-44de-86e3-642569c96730 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [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: Fri, 28 Dec 2007 15:43:46 -0000 This is a multi-part message in MIME format. --------------040306090002060801000303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Robert Millan wrote: > On Sun, Nov 18, 2007 at 07:40:15PM +0100, Christian Franke wrote: > >> No, it did not work because check_device() returned 1 ("exists") on >> (*name == 0). This results in 8 bogus "(hd N)\t\n" lines and wrong N for >> the real devices. >> >> Yes, it would work now, because the patch also fixes this bug :-) >> > > Ok, so in that case you don't need... > > >> +#ifndef __CYGWIN__ >> ... >> +#ifndef __CYGWIN__ >> ... >> +#endif /* __CYGWIN__ */ >> > > ...because you already fixed the problem in: > > >> - /* If DEVICE is empty, just return 1. */ >> + /* If DEVICE is empty, just return error. */ >> if (*device == 0) >> - return 1; >> - >> + return 0; >> > > ? > New version of the patch is attached. Christian 2007-12-28 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): Add static. Return error instead of success on empty name. (make_device_map): Move label inside linux specific code to prevent compiler warning. --------------040306090002060801000303 Content-Type: text/x-patch; name="grub2-mkdevicemap-Cygwin-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-mkdevicemap-Cygwin-2.patch" --- grub2.orig/util/grub-mkdevicemap.c 2007-12-25 23:15:25.750000000 +0100 +++ grub2/util/grub-mkdevicemap.c 2007-12-28 16:14:25.437500000 +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. */ @@ -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. */ @@ -277,15 +287,15 @@ 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) @@ -513,9 +523,10 @@ make_device_map (const char *device_map, } } } -#endif /* __linux__ */ finish: +#endif /* __linux__ */ + if (fp != stdout) fclose (fp); } --------------040306090002060801000303--