grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem in usage of grub_errno...


From: Marco Gerards
Subject: Re: problem in usage of grub_errno...
Date: Fri, 09 Dec 2005 23:29:32 +0100
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Vesa Jääskeläinen <address@hidden> writes:

> Some folks might have overlooked my earlier post as I wrote it to video
> subsystem thread. As this problem needs some kind of resolution and it
> affects larger area of code than just video subsystem it needs to be
> discussed first.
>
> Problem is this:
> 1. error occures and grub_errno is being set to something else than
> GRUB_ERR_NONE (0).
> 2. now some operation needs to read from disk, but it will fail as
> gurb_errno was set.
>
> Real world example:
> Let's assume that there is a file not found exception. There is graphics
> mode activated and not all fonts are cached in memory (as is currently
> the case). Now as file not found exception sets grub_errno to
> GRUB_ERR_FILE_NOT_FOUND and most likely sets some string to grub_errmsg.
>  All is good so far. But when the actual rendering happens, and font
> manager tries to read font data from disk it fails, because grub_errno
> is set. In many place there is code like this "if (grub_errno) return
> grub_errno;" in file system code and in disk drivers. Now if grub_errno
> is set else where this code will fail, even if there wasn't really i/o
> error.

You should in general test all functions if they return an error.  If
you think an error should be ignored, set grub_errno to 0.  So if the
file was not found you should either clear the error and ignore it, or
return the error so the error can be reported to the user.

But I don't like it that the console can get critical errors.  When
can and does this happen?  What are the worst case scenarious?

--
Marco





reply via email to

[Prev in Thread] Current Thread [Next in Thread]