From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: grub-probe detects ext4 wronly as ext2
Date: Sat, 5 Jul 2008 14:07:57 +0200 [thread overview]
Message-ID: <20080705120757.GA1647@thorin> (raw)
In-Reply-To: <1215204095.26019.142.camel@localhost>
On Fri, Jul 04, 2008 at 10:41:35PM +0200, Javier Martín wrote:
> Wonderful! I was sick of jumping through hoops with cvs diff.
I wasn't even using cvs diff! (you don't want to know what my replacement
dance was) ;-)
> > I'd suggest making the "RW compatible" etc notes a bit more ellaborate to make
> > it clear what they mean (I'm confused myself).
> Done, though now I might have over-elaborated
I think that's ok, comments don't eat space, so it's better to risk explaining
too much than being short of explaining everything.
> > Since we know which one applies, why not tell grub_error about it? We could
> > leave the "not an ext2 filesystem" call unmodified and add another one for
> > this particular error.
> >
> I may have overstepped a bit, but I've thought it more sensible to
> replace all "goto fail;"s for calls to a new macro MOUNT_FAIL taking a
> string argument which is saved in the new variable err_msg, and then
> jumps to fail which shows _that_ message instead of the old one. Then, I
> wrote informative messages for each error condition instead of just "not
> an ext2 filesystem".
Looks a bit ugly, but I don't have any objection if it makes code smaller
(by eliminating duped grub_error calls).
However, adding new strings is expensive, since they tend to take size more
easily than code. I would be careful about that.
> grub_ext2_mount (grub_disk_t disk)
> {
> struct grub_ext2_data *data;
> + const char *err_msg = 0;
Is this "const" right? You're modifiing its value.
> grub_disk_read (disk, 1 * 2, 0, sizeof (struct grub_ext2_sblock),
> (char *) &data->sblock);
> if (grub_errno)
> - goto fail;
> + EXT2_DRIVER_MOUNT_FAIL("could not read the superblock")
This overrides the grub_errno and grub_errmsg provided by grub_disk_read and
replaces them with values that hide the true problem. If there was a disk
read error, we really want to know about it from the lower layer.
> /* Make sure this is an ext2 filesystem. */
> if (grub_le_to_cpu16 (data->sblock.magic) != EXT2_MAGIC)
> - goto fail;
> + EXT2_DRIVER_MOUNT_FAIL("not an ext2 filesystem (superblock magic mismatch)")
No need to ellaborate here; by definition, the magic number makes the
difference between a corrupt ext2 and something that is not ext2. So
you can just say it's not ext2.
> + /* Check the FS doesn't have feature bits enabled that we don't support. */
> + if (grub_le_to_cpu32 (data->sblock.feature_incompat)
> + & ~(EXT2_DRIVER_SUPPORTED_INCOMPAT | EXT2_DRIVER_IGNORED_INCOMPAT))
> + EXT2_DRIVER_MOUNT_FAIL("filesystem has unsupported incompatible features")
Ok.
> if (grub_errno)
> - goto fail;
> + EXT2_DRIVER_MOUNT_FAIL("could not read the root directory inode")
Ok.
--
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 /.)
next prev parent reply other threads:[~2008-07-05 16:37 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-29 18:11 grub-probe detects ext4 wronly as ext2 Felix Zielcke
2008-06-29 18:46 ` Javier Martín
2008-06-29 19:17 ` Bean
2008-06-29 19:53 ` Javier Martín
2008-06-29 21:19 ` Robert Millan
2008-06-30 3:02 ` Javier Martín
2008-06-30 7:10 ` Felix Zielcke
2008-06-30 11:14 ` Isaac Dupree
2008-06-30 12:12 ` Javier Martín
2008-06-30 12:27 ` Bean
2008-06-30 12:43 ` Javier Martín
2008-07-01 16:08 ` Robert Millan
2008-07-01 16:25 ` Pavel Roskin
2008-07-01 18:42 ` Javier Martín
2008-07-01 19:01 ` Pavel Roskin
2008-07-01 20:48 ` Robert Millan
2008-07-01 23:05 ` Javier Martín
2008-07-01 23:28 ` Javier Martín
2008-07-02 14:22 ` Robert Millan
2008-07-02 16:03 ` Pavel Roskin
2008-07-02 19:32 ` Javier Martín
2008-07-03 14:02 ` Robert Millan
2008-07-03 14:21 ` Isaac Dupree
2008-07-03 17:07 ` Javier Martín
2008-07-04 0:08 ` Robert Millan
2008-07-04 1:20 ` Javier Martín
2008-08-05 17:23 ` Felix Zielcke
2008-08-06 10:36 ` Felix Zielcke
2008-08-11 0:35 ` Javier Martín
2008-08-11 7:56 ` Felix Zielcke
2008-07-04 1:32 ` Javier Martín
2008-07-04 6:49 ` Bean
2008-07-04 8:33 ` Felix Zielcke
2008-07-04 10:34 ` Javier Martín
2008-07-04 11:29 ` Bean
2008-07-04 12:00 ` Javier Martín
2008-07-04 14:09 ` Robert Millan
2008-07-04 14:33 ` Javier Martín
2008-07-04 14:11 ` Bean
2008-07-04 14:34 ` Javier Martín
2008-07-04 14:04 ` Robert Millan
2008-07-04 14:23 ` Robert Millan
2008-07-04 14:21 ` Robert Millan
2008-07-04 14:45 ` Javier Martín
2008-07-04 18:57 ` Robert Millan
2008-07-04 20:41 ` Javier Martín
2008-07-05 12:07 ` Robert Millan [this message]
2008-07-05 18:36 ` Javier Martín
2008-07-16 15:09 ` Javier Martín
2008-07-16 15:27 ` Felix Zielcke
2008-07-16 16:38 ` Javier Martín
2008-07-16 17:13 ` Felix Zielcke
2008-07-16 17:21 ` Felix Zielcke
2008-07-16 17:44 ` Felix Zielcke
2008-07-16 19:07 ` Javier Martín
2008-07-16 19:33 ` Felix Zielcke
2008-07-19 14:27 ` Robert Millan
2008-08-11 14:14 ` Javier Martín
2008-08-27 13:58 ` Felix Zielcke
2008-08-30 11:17 ` Robert Millan
2008-08-30 21:28 ` Javier Martín
2008-09-24 17:05 ` Javier Martín
2009-02-04 7:41 ` Felix Zielcke
2009-02-04 13:08 ` Javier Martín
2009-02-07 19:30 ` Felix Zielcke
2009-02-07 23:54 ` Javier Martín
2009-02-08 0:28 ` Robert Millan
2008-07-01 16:03 ` Robert Millan
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=20080705120757.GA1647@thorin \
--to=rmh@aybabtu.com \
--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.