From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KFAln-0003Jy-Uh for mharc-grub-devel@gnu.org; Sat, 05 Jul 2008 12:37:56 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KFAll-0003IR-KC for grub-devel@gnu.org; Sat, 05 Jul 2008 12:37:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KFAlj-0003GQ-RE for grub-devel@gnu.org; Sat, 05 Jul 2008 12:37:53 -0400 Received: from [199.232.76.173] (port=33779 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KFAlj-0003GB-Hv for grub-devel@gnu.org; Sat, 05 Jul 2008 12:37:51 -0400 Received: from mx20.gnu.org ([199.232.41.8]:22324) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KFAlW-0001lw-Tu for grub-devel@gnu.org; Sat, 05 Jul 2008 12:37:39 -0400 Received: from aybabtu.com ([69.60.117.155]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KF6ZF-0001v7-MH for grub-devel@gnu.org; Sat, 05 Jul 2008 08:08:41 -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.69) (envelope-from ) id 1KF6V3-0005gC-Bc for grub-devel@gnu.org; Sat, 05 Jul 2008 14:04:21 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1KF6YX-0000Zj-R3 for grub-devel@gnu.org; Sat, 05 Jul 2008 14:07:57 +0200 Date: Sat, 5 Jul 2008 14:07:57 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080705120757.GA1647@thorin> References: <20080702142245.GA21064@thorin> <1215027160.9353.125.camel@localhost> <20080703140211.GA19341@thorin> <1215104875.8123.23.camel@localhost> <20080704000829.GE4074@thorin> <1215135163.26019.44.camel@localhost> <20080704142125.GC2663@thorin> <1215182702.26019.130.camel@localhost> <20080704185723.GB32625@thorin> <1215204095.26019.142.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1215204095.26019.142.camel@localhost> 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 mx20.gnu.org: Genre and OS details not recognized. X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) Subject: Re: grub-probe detects ext4 wronly as ext2 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: Sat, 05 Jul 2008 16:37:54 -0000 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 I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.)