From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KT9LK-0005ov-Rn for mharc-grub-devel@gnu.org; Wed, 13 Aug 2008 01:56:22 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KT9LI-0005mL-8R for grub-devel@gnu.org; Wed, 13 Aug 2008 01:56:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KT9LF-0005jV-NB for grub-devel@gnu.org; Wed, 13 Aug 2008 01:56:18 -0400 Received: from [199.232.76.173] (port=45101 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KT9LF-0005jK-Jt for grub-devel@gnu.org; Wed, 13 Aug 2008 01:56:17 -0400 Received: from moutng.kundenserver.de ([212.227.126.188]:52447) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KT9LE-0003kw-Tw for grub-devel@gnu.org; Wed, 13 Aug 2008 01:56:17 -0400 Received: from [85.180.58.215] (e180058215.adsl.alicedsl.de [85.180.58.215]) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis) id 0ML2xA-1KT9LD38nZ-0003ZV; Wed, 13 Aug 2008 07:56:16 +0200 From: Felix Zielcke To: The development of GRUB 2 In-Reply-To: <20080812224041.GB3141@thorin> References: <1218558487.19045.8.camel@fz.local> <1218558734.19045.10.camel@fz.local> <87fxp9di59.fsf@xs4all.nl> <20080812224041.GB3141@thorin> Content-Type: multipart/mixed; boundary="=-n6KV8yFhv+s+71f5Y1Og" Date: Wed, 13 Aug 2008 07:56:20 +0200 Message-Id: <1218606980.4008.9.camel@fz.local> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-Provags-ID: V01U2FsdGVkX1/X9z6cVPRZYZYbXaynl7QQyu00J7ZJ87QziZG 4Q01NAwiQ9vMbLhg1eOsI4eoALlWLzGr+RVEySMMoyU+2zGe4C Z24JnopsZ3440XT/Rq0+e5uyFu9fhQY X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) 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 05:56:20 -0000 --=-n6KV8yFhv+s+71f5Y1Og Content-Type: text/plain Content-Transfer-Encoding: 7bit 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. > >"...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 :) 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. * kern/err.c [! GRUB_UTIL] (grub_print_error): Likewise. * include/util/misc.h (grub_print_error): New function prototype. * 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. --=-n6KV8yFhv+s+71f5Y1Og Content-Disposition: attachment; filename=error.diff Content-Type: text/x-patch; name=error.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 #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; + } +} --=-n6KV8yFhv+s+71f5Y1Og--