From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K1M0D-0002uK-HF for mharc-grub-devel@gnu.org; Wed, 28 May 2008 09:47:41 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K1M0B-0002uD-U8 for grub-devel@gnu.org; Wed, 28 May 2008 09:47:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K1M0B-0002u1-GF for grub-devel@gnu.org; Wed, 28 May 2008 09:47:39 -0400 Received: from [199.232.76.173] (port=33366 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K1M0B-0002ty-Ad for grub-devel@gnu.org; Wed, 28 May 2008 09:47:39 -0400 Received: from aybabtu.com ([69.60.117.155]:50491) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K1M0B-00075X-9A for grub-devel@gnu.org; Wed, 28 May 2008 09:47:39 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1K1Lzr-0006oM-IU for grub-devel@gnu.org; Wed, 28 May 2008 15:47:24 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1K1LzM-000735-QJ for grub-devel@gnu.org; Wed, 28 May 2008 15:46:48 +0200 Date: Wed, 28 May 2008 15:46:48 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080528134648.GD26495@thorin> References: <1210552473.24691.18.camel@dv> <20080512153229.GB1841@thorin> <1210889456.2360.10.camel@dv> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1210889456.2360.10.camel@dv> 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 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: Wed, 28 May 2008 13:47:40 -0000 On Thu, May 15, 2008 at 06:10:56PM -0400, Pavel Roskin wrote: > 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. Fine with me. Will you check that in soon? -- Robert Millan I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.)