All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Gerards <mgerards@xs4all.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] kern/err.c + disk/raid.c error handling fixes
Date: Wed, 13 Aug 2008 11:47:50 +0200	[thread overview]
Message-ID: <87abfhb60p.fsf@xs4all.nl> (raw)
In-Reply-To: <1218606980.4008.9.camel@fz.local> (Felix Zielcke's message of "Wed, 13 Aug 2008 07:56:20 +0200")

Felix Zielcke <fzielcke@z-51.de> writes:

> On Tue, Aug 12, 2008 at 11:42:58PM +0200, Marco Gerards wrote:
>> >         * kern/err.c [GRUB_UTIL]: Include <stdio.h>.
>
>> 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  <fzielcke@z-51.de>
>
>         * 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 <grub/err.h> 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;
> +    }
> +}




  reply	other threads:[~2008-08-13  9:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-12 16:28 [PATCH] kern/err.c + disk/raid.c error handling fixes Felix Zielcke
2008-08-12 16:32 ` Felix Zielcke
2008-08-12 21:42   ` Marco Gerards
2008-08-12 22:40     ` Robert Millan
2008-08-13  5:56       ` Felix Zielcke
2008-08-13  9:47         ` Marco Gerards [this message]
2008-08-13 20:31           ` Felix Zielcke
2008-08-13 20:38             ` Felix Zielcke
2008-08-13 21:50             ` Robert Millan
2008-08-13 22:39               ` Felix Zielcke
2008-08-13 23:30                 ` Felix Zielcke
2008-08-14  7:13                   ` Marco Gerards
2008-08-14 11:02                     ` Felix Zielcke
2008-08-14 18:08                       ` Robert Millan
2008-08-14 18:16                         ` Vesa Jääskeläinen
2008-08-14 18:27                       ` Marco Gerards
2008-08-14 18:48                         ` Felix Zielcke
2008-08-13 23:32                 ` Robert Millan
2008-08-13  9:40       ` Marco Gerards

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=87abfhb60p.fsf@xs4all.nl \
    --to=mgerards@xs4all.nl \
    --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.