[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFC] Simplifying linux_find_partition()
From: |
Robert Millan |
Subject: |
Re: [PATCH RFC] Simplifying linux_find_partition() |
Date: |
Wed, 28 May 2008 15:46:48 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
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
<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)