bug-grub
[Top][All Lists]
Advanced

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

Re: grub 0.90 prevents Standby in Windows


From: Thierry Laronde
Subject: Re: grub 0.90 prevents Standby in Windows
Date: Fri, 26 Oct 2001 22:25:30 +0200
User-agent: Mutt/1.2.5i

On Fri, Oct 26, 2001 at 12:09:36PM -0700, address@hidden wrote:
> 
> I'm for it.  ;-)
> 
> I think Okuji's idea of a "hook", to keep things simple and extensible,
> is a good one (that way, each bit of code can be included with no
> reference to others and no messy "#define"'s to remove unwanted ones).
> 
> I'm presuming this takes the form of a function pointer, perhaps called
> "boot_hook", which gets called prior to the final boot stage, after
> all the checks have been made.  To take advantage of it, each bit of
> code that wanted to do this would replace the value of "boot_hook" with
> it's own function, which, at the end, calls the previous value.
> 
> If you really want to keep the code simple, you can put the function for
> the final part of the boot in that function pointer, so there is no "NULL"
> case to check for.  Each bit of code would have it's own global variable
> to put the old value of "boot_hook" into, which starts out as NULL, and
> if the code can get called more than once (presuming that's OK and it
> doesn't corrupt the state somehow), then it can check it's own variable
> first to see if it's NULL (i.e. it hasn't been put in the boot_hook
> chain yet).
> 
> You just call "boot_hook", each one calls the next, until the final one
> calls the real boot function it redirected from.

Nice idea. With some care about "dependencies" of changes [every
function is an atomic one, that is put the system back in a state
independant from other changes]. 
As noted by Okuji, the problem, as always, will be that without dynamic
memory allocation we will have to allocate a fix size array of
structures like :

struct restore_function {
        int id; /* for example an enum {RESTORE_FOO, RESTORE_BAR,...} */
        int (* pf) ();
        struct restore_function *next;
};      

id being there in order to be sure that we don't invoke a function
twice.

Without memory allocation, we will another time increase the size of the
binary.
-- 
Thierry Laronde (Alceste) <address@hidden>
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C



reply via email to

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