From: Hollis Blanchard <hollis@penguinppc.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: user-defined hooks
Date: Thu, 30 Nov 2006 13:59:18 -0600 [thread overview]
Message-ID: <1164916758.4067.63.camel@diesel> (raw)
In-Reply-To: <87k61c3e94.fsf@xs4all.nl>
On Thu, 2006-11-30 at 20:50 +0100, Marco Gerards wrote:
> Actually, what I would prefer is something hooks. It would be nice if
> the C code in GRUB and perhaps also scripts can be hooked anywhere.
> We have to be very careful about this, so perhaps limit the sets of
> commands that can be used this way. But I think it will make GRUB
> more flexible while it is not too much effort.
I like this idea.
> I am thinking of the following functions:
>
> One to install a hook:
> grub_err_t grub_hook_register (const char *name, (*hook) (...));
>
> To trigger the hook (for example, when the user types something,
> selects another menu entry, etc.
> void grub_hook_call (const char *name, ...);
>
> How to pass arguments to functions and to scripts is something that we
> have to think about. For example, scripting functions have to get
> strings, while in other cases we just want to deal with regular
> function calls. Perhaps a printf-like mechanism can help us with
> this.
I do not think it's important that we be able to hook C functions
directly. In other words, the argument passed to --function (below)
should be a script command (or script function), and not a C function
name.
> In that case your problem can be solved by using:
>
> function handlemenu {
> beep depending on menuentry selected, the index is passed to this function
> }
>
> hook --install --hook=select-menu-entry --function=handlemenu
Defining the set of useful hooks, the arguments passed to each, and
documenting them will be critical. Also, just like with commands, once
we implement a hook we can't remove or change it without breaking config
files.
-Hollis
next prev parent reply other threads:[~2006-11-30 19:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-30 19:00 grub2 accessibility: beeps Hollis Blanchard
2006-11-30 19:50 ` Marco Gerards
2006-11-30 19:59 ` Hollis Blanchard [this message]
2006-12-13 13:18 ` user-defined hooks Thomas Schwinge
2006-12-02 17:15 ` grub2 accessibility: beeps Yoshinori K. Okuji
2006-12-04 20:40 ` Marco Gerards
2006-12-05 20:02 ` Yoshinori K. Okuji
2006-12-13 12:45 ` Marco Gerards
2006-12-13 21:38 ` Yoshinori K. Okuji
2006-12-01 15:05 ` tgingold
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=1164916758.4067.63.camel@diesel \
--to=hollis@penguinppc.org \
--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.