From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KZOUE-0004O3-KF for mharc-grub-devel@gnu.org; Sat, 30 Aug 2008 07:19:22 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KZOUD-0004Mq-9y for grub-devel@gnu.org; Sat, 30 Aug 2008 07:19:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KZOUC-0004ME-JU for grub-devel@gnu.org; Sat, 30 Aug 2008 07:19:20 -0400 Received: from [199.232.76.173] (port=58552 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZOUC-0004MA-H0 for grub-devel@gnu.org; Sat, 30 Aug 2008 07:19:20 -0400 Received: from aybabtu.com ([69.60.117.155]:40100) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KZOUC-0005SN-7g for grub-devel@gnu.org; Sat, 30 Aug 2008 07:19:20 -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 1KZOKL-0006kW-Fi for grub-devel@gnu.org; Sat, 30 Aug 2008 13:09:09 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1KZOSn-0000zH-9E for grub-devel@gnu.org; Sat, 30 Aug 2008 13:17:53 +0200 Date: Sat, 30 Aug 2008 13:17:53 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080830111753.GA16775@thorin> References: <20080704000829.GE4074@thorin> <1215135163.26019.44.camel@localhost> <20080704142125.GC2663@thorin> <1215182702.26019.130.camel@localhost> <20080704185723.GB32625@thorin> <1215204095.26019.142.camel@localhost> <20080705120757.GA1647@thorin> <1215282973.26019.183.camel@localhost> <20080719142707.GA23778@thorin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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: 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, 30 Aug 2008 11:19:21 -0000 On Mon, Aug 11, 2008 at 04:14:00PM +0200, Javier Martín wrote: > >> > 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. > >> Well, the old version did just the same (even worse, because the message > >> was generic). What would be the correct path of action here? I mean, how > >> can we propagate the error messages? > > > > It shouldn't call grub_error(). > > So in the cases the fail is caused by an underlying error (like I/O) > the code should just return failure and leave the old error in errno > and errmsg? Yes. > static struct grub_ext2_data * > grub_ext2_mount (grub_disk_t disk) > { > struct grub_ext2_data *data; > + const char *local_error = 0; Please use NULL for pointers. > - if (grub_errno) > + if (grub_errno != GRUB_ERR_NONE) Why? > - goto fail; > + EXT2_DRIVER_MOUNT_FAIL(0); I find very little use in this. I assume it's supposed to simplify things, but in fact it adds an extra level of indirection for someone who's reading the code. It provides no runtime improvement, and it's inconsistent with what we do elsewhere. > + /* Only call grub_error if the fail was _not_ caused by underlying errors. */ No need to document this. It's the same deal in a huge amount of routines throurough the GRUB source. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."