From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JwlfI-0000nz-27 for mharc-grub-devel@gnu.org; Thu, 15 May 2008 18:11:08 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JwlfG-0000m4-4o for grub-devel@gnu.org; Thu, 15 May 2008 18:11:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JwlfB-0000fq-L1 for grub-devel@gnu.org; Thu, 15 May 2008 18:11:05 -0400 Received: from [199.232.76.173] (port=37713 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JwlfB-0000fj-1X for grub-devel@gnu.org; Thu, 15 May 2008 18:11:01 -0400 Received: from c60.cesmail.net ([216.154.195.49]:36279) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1JwlfA-0000i3-Eq for grub-devel@gnu.org; Thu, 15 May 2008 18:11:00 -0400 Received: from unknown (HELO relay.cesmail.net) ([192.168.1.81]) by c60.cesmail.net with ESMTP; 15 May 2008 18:10:58 -0400 Received: from [192.168.1.21] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by relay.cesmail.net (Postfix) with ESMTP id 3AC74619058 for ; Thu, 15 May 2008 18:10:57 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <20080512153229.GB1841@thorin> References: <1210552473.24691.18.camel@dv> <20080512153229.GB1841@thorin> Content-Type: text/plain Date: Thu, 15 May 2008 18:10:56 -0400 Message-Id: <1210889456.2360.10.camel@dv> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1 (2.22.1-2.fc9) Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH RFC] Simplifying linux_find_partition() 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: Thu, 15 May 2008 22:11:06 -0000 On Mon, 2008-05-12 at 17:32 +0200, Robert Millan wrote: > > Also, I checked devices.txt from Linux, and I see a simple pattern > > there. If the device ends in a number, the partitions are made by > > adding "p" and the number. Otherwise, only the number is added. > > Good catch! But please make sure it's never called for partitions. As far as I understand, the code already assumes that. linux_find_partition() is only called if disk->partition is not NULL. Besides, open_device() is passed the disk information as grub_disk_t, which should not be used for partitions. > Also, perhaps an even simpler logic could be: > > if (real_dev[len - 1] >= '0' && real_dev[len - 1] <= '9') > real_dev[len++] = 'p'; > > then you can treat real_dev as "%dp%d" form unconditionally. Would > that > work? It would work, but I prefer not give "len" a conditional meaning, where it's the length of the original device name for devfs devices, but the length of the partition name if "p" is appended. Conditional meanings can cause bugs. -- Regards, Pavel Roskin