From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KTCtw-0007jB-DU for mharc-grub-devel@gnu.org; Wed, 13 Aug 2008 05:44:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KTCtu-0007g6-CP for grub-devel@gnu.org; Wed, 13 Aug 2008 05:44:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KTCts-0007ec-AE for grub-devel@gnu.org; Wed, 13 Aug 2008 05:44:17 -0400 Received: from [199.232.76.173] (port=46810 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTCts-0007eR-4B for grub-devel@gnu.org; Wed, 13 Aug 2008 05:44:16 -0400 Received: from smtp-vbr6.xs4all.nl ([194.109.24.26]:2405) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KTCtr-0000oU-HT for grub-devel@gnu.org; Wed, 13 Aug 2008 05:44:15 -0400 Received: from localhost.localdomain (249-174.surfsnel.dsl.internl.net [145.99.174.249]) by smtp-vbr6.xs4all.nl (8.13.8/8.13.8) with ESMTP id m7D9iE47077209 for ; Wed, 13 Aug 2008 11:44:14 +0200 (CEST) (envelope-from mgerards@xs4all.nl) From: Marco Gerards To: The development of GRUB 2 References: <1218558487.19045.8.camel@fz.local> <1218558734.19045.10.camel@fz.local> <87fxp9di59.fsf@xs4all.nl> <20080812224041.GB3141@thorin> <1218606980.4008.9.camel@fz.local> Mail-Copies-To: mgerards@xs4all.nl Date: Wed, 13 Aug 2008 11:47:50 +0200 In-Reply-To: <1218606980.4008.9.camel@fz.local> (Felix Zielcke's message of "Wed, 13 Aug 2008 07:56:20 +0200") Message-ID: <87abfhb60p.fsf@xs4all.nl> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 Subject: Re: [PATCH] kern/err.c + disk/raid.c error handling fixes 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: Wed, 13 Aug 2008 09:44:19 -0000 Felix Zielcke writes: > On Tue, Aug 12, 2008 at 11:42:58PM +0200, Marco Gerards wrote: >> > * kern/err.c [GRUB_UTIL]: Include . > >> Please don't do this. Why do you want this? > > It's needed for fprintf, and fprintf is only useful for GRUB_UTIL. I understood that. With this I meant "changing the kernel for GRUB_UTIL" :) >> >"...reset grub_errno. Do not..." >> (double space) > > Right, I should really pay more attention to these small little details. :-) > Am Mittwoch, den 13.08.2008, 00:40 +0200 schrieb Robert Millan: >> > >> > It would be better to make a util/misc.c:grub_print_error instead of this >> >> Problem is that kern/err.c is already included in grub-probe. So then we would >> have to add util/misc.c:grub_print_error _and_ disable grub_print_error. > > Thanks for your hint. > >> > Please use -up for diff, you can use: >> > $ svn diff --diff-cmd diff -x -up >> >> Thanks for the tip, I've been looking for this ;-) >> > I made now a svn-diff alias for this :) Great :-) > I hope it's now better, but I was unsure about the `new function' in > changelog it isn't really a new one more a modified one. > > 2008-08-13 Felix Zielcke > > * include/kern/err.h [! GRUB_UTIL]: Disable. Disable what? BTW, this file does not exist. > * kern/err.c [! GRUB_UTIL] (grub_print_error): Likewise. Why? > * include/util/misc.h (grub_print_error): New function prototype. If you included here... > * util/misc.c (grub_print_error): New function. > > * disk/raid.c (GRUB_MOD_INIT): Use grub_print_error() to show RAID > errors and reset grub_errno. Do not give errors to the upper layer. > > > Index: kern/err.c > =================================================================== > --- kern/err.c (Revision 1802) > +++ kern/err.c (Arbeitskopie) > @@ -113,6 +113,7 @@ grub_error_pop (void) > } > } > > +#ifndef GRUB_UTIL > void > grub_print_error (void) > { > @@ -132,3 +133,4 @@ grub_print_error (void) > grub_error_stack_assert = 0; > } > } > +#endif > Index: include/grub/err.h > =================================================================== > --- include/grub/err.h (Revision 1802) > +++ include/grub/err.h (Arbeitskopie) > @@ -63,6 +63,9 @@ grub_err_t EXPORT_FUNC(grub_error) (grub > void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn)); > void EXPORT_FUNC(grub_error_push) (void); > int EXPORT_FUNC(grub_error_pop) (void); > + > +#ifndef GRUB_UTIL > void EXPORT_FUNC(grub_print_error) (void); > +#endif Why does this have to be conditional? > #endif /* ! GRUB_ERR_HEADER */ > Index: include/grub/util/misc.h > =================================================================== > --- include/grub/util/misc.h (Revision 1802) > +++ include/grub/util/misc.h (Arbeitskopie) > @@ -55,4 +55,5 @@ void grub_util_write_image_at (const voi > FILE *out); > char *grub_util_get_disk_name (int disk, char *name); > > +void grub_print_error (void); > #endif /* ! GRUB_UTIL_MISC_HEADER */ > Index: util/misc.c > =================================================================== > --- util/misc.c (Revision 1802) > +++ util/misc.c (Arbeitskopie) > @@ -300,3 +300,23 @@ grub_arch_sync_caches (void *address __a > grub_size_t len __attribute__ ((unused))) > { > } > + > +void > +grub_print_error (void) > +{ > + /* Print error messages in reverse order. First print active error message > + and then empty error stack. */ > + do > + { > + if (grub_errno != GRUB_ERR_NONE) > + fprintf (stderr ,"error: %s\n", grub_errmsg); > + } > + while (grub_error_pop ()); > + > + /* If there was an assert while using error stack, report about it. */ > + if (grub_error_stack_assert) > + { > + fprintf (stderr, "assert: error stack overflow detected!\n"); > + grub_error_stack_assert = 0; > + } > +}