From: Pavel Roskin <proski@gnu.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH RFC] Simplifying linux_find_partition()
Date: Thu, 15 May 2008 18:10:56 -0400 [thread overview]
Message-ID: <1210889456.2360.10.camel@dv> (raw)
In-Reply-To: <20080512153229.GB1841@thorin>
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
next prev parent reply other threads:[~2008-05-15 22:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-12 0:34 [PATCH RFC] Simplifying linux_find_partition() Pavel Roskin
2008-05-12 15:32 ` Robert Millan
2008-05-15 22:10 ` Pavel Roskin [this message]
2008-05-28 13:46 ` Robert Millan
2008-05-30 21:55 ` Pavel Roskin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1210889456.2360.10.camel@dv \
--to=proski@gnu.org \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.