From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JuRzB-0004L2-Bx for mharc-grub-devel@gnu.org; Fri, 09 May 2008 08:46:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JuRz9-0004JP-BR for grub-devel@gnu.org; Fri, 09 May 2008 08:46:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JuRz7-0004Ib-Mm for grub-devel@gnu.org; Fri, 09 May 2008 08:46:02 -0400 Received: from [199.232.76.173] (port=44350 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuRz7-0004IT-CK for grub-devel@gnu.org; Fri, 09 May 2008 08:46:01 -0400 Received: from aybabtu.com ([69.60.117.155]:36767) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JuRz7-0004CV-AE for grub-devel@gnu.org; Fri, 09 May 2008 08:46:01 -0400 Received: from [192.168.10.6] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1JuRz4-0001qE-35 for grub-devel@gnu.org; Fri, 09 May 2008 14:46:00 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1JuRyE-0004Z3-IV for grub-devel@gnu.org; Fri, 09 May 2008 14:45:06 +0200 Date: Fri, 9 May 2008 14:45:06 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080509124506.GA3705@thorin> References: <47473879.1020004@t-online.de> <4822142F.1040505@t-online.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4822142F.1040505@t-online.de> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] biosdisk, getroot 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, 09 May 2008 12:46:03 -0000 On Wed, May 07, 2008 at 10:42:23PM +0200, Christian Franke wrote: > + > + /* Check signature. */ > + if (!(buf[0x1fe] == 0x55 && buf[0x1ff] == 0xaa)) > + return ~0; > + > + /* Serial number offset depends on boot sector type. */ > + if (mbr) > + n = 0x1b8; > + else if (memcmp (buf + 0x03, "NTFS", 4) == 0) > + n = 0x048; > + else if (memcmp (buf + 0x52, "FAT32", 5) == 0) > + n = 0x043; > + else if (memcmp (buf + 0x36, "FAT", 3) == 0) > + n = 0x027; Did you consider using a struct here? > + /* Cygwin returns the partition serial number in stat.st_dev. > + This is never identical to the device number of the emulated > + /dev/sdXN device, so above find_root_device () does not work. > + Search the partion with the same serial in boot sector instead. */ > + char devpath[sizeof ("/dev/sda15") + 13]; Where does this 13 come from? Would be nice to make it explicit (e.g. sizeof(something) or so). > +#ifndef __CYGWIN__ > #ifdef __linux__ > /* We first try to find the device in the /dev/mapper directory. If > we don't do this, we get useless device names like /dev/dm-0 for > @@ -242,12 +373,19 @@ grub_guess_root_device (const char *dir) > os_dev = find_root_device ("/dev", st.st_dev); > } > > +#else > + /* Cygwin specific function. */ > + os_dev = find_cygwin_root_device (dir, st.st_dev); > + > +#endif /* __CYGWIN__ */ The logic here seems a bit over-complicated. Surely whenever you have __linux__ you don't have __CYGWIN__. Are you sure it can't be simplified? > +#ifndef __CYGWIN__ > /* Check for LVM. */ > if (!strncmp (os_dev, "/dev/mapper/", 12)) > return GRUB_DEV_ABSTRACTION_LVM; > @@ -255,6 +393,7 @@ grub_util_get_dev_abstraction (const char *os_dev) > /* Check for RAID. */ > if (!strncmp (os_dev, "/dev/md", 7)) > return GRUB_DEV_ABSTRACTION_RAID; > +#endif /* !__CYGWIN__ */ I think what we're missing here is "ifdef __linux__" since both LVM and dmRAID are Linux-specific. -- Robert Millan I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.)