* include/grub/loader.h (grub_loader_register_preboot_hook):

Use struct preboot * and not void * for handle. All users updated.
	(grub_loader_unregister_preboot_hook): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-13 00:28:14 +01:00
parent 1bc8f60db7
commit 74dbd24466
8 changed files with 28 additions and 20 deletions

View file

@ -1,3 +1,9 @@
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/loader.h (grub_loader_register_preboot_hook):
Use struct preboot * and not void * for handle. All users updated.
(grub_loader_unregister_preboot_hook): Likewise.
2011-12-12 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/charset.h (GRUB_MAX_UTF8_PER_UTF16): New const.

View file

@ -1426,7 +1426,7 @@ static struct grub_usb_controller_dev usb_controller =
.detect_dev = grub_ohci_detect_dev
};
static void *fini_hnd;
static struct grub_preboot *fini_hnd;
GRUB_MOD_INIT(ohci)
{

View file

@ -31,17 +31,17 @@ static grub_err_t (*grub_loader_boot_func) (void);
static grub_err_t (*grub_loader_unload_func) (void);
static int grub_loader_noreturn;
struct grub_preboot_t
struct grub_preboot
{
grub_err_t (*preboot_func) (int);
grub_err_t (*preboot_rest_func) (void);
grub_loader_preboot_hook_prio_t prio;
struct grub_preboot_t *next;
struct grub_preboot_t *prev;
struct grub_preboot *next;
struct grub_preboot *prev;
};
static int grub_loader_loaded;
static struct grub_preboot_t *preboots_head = 0,
static struct grub_preboot *preboots_head = 0,
*preboots_tail = 0;
int
@ -51,18 +51,18 @@ grub_loader_is_loaded (void)
}
/* Register a preboot hook. */
void *
struct grub_preboot *
grub_loader_register_preboot_hook (grub_err_t (*preboot_func) (int noreturn),
grub_err_t (*preboot_rest_func) (void),
grub_loader_preboot_hook_prio_t prio)
{
struct grub_preboot_t *cur, *new_preboot;
struct grub_preboot *cur, *new_preboot;
if (! preboot_func && ! preboot_rest_func)
return 0;
new_preboot = (struct grub_preboot_t *)
grub_malloc (sizeof (struct grub_preboot_t));
new_preboot = (struct grub_preboot *)
grub_malloc (sizeof (struct grub_preboot));
if (! new_preboot)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY, "hook not added");
@ -96,9 +96,9 @@ grub_loader_register_preboot_hook (grub_err_t (*preboot_func) (int noreturn),
}
void
grub_loader_unregister_preboot_hook (void *hnd)
grub_loader_unregister_preboot_hook (struct grub_preboot *hnd)
{
struct grub_preboot_t *preb = hnd;
struct grub_preboot *preb = hnd;
if (preb->next)
preb->next->prev = preb->prev;
@ -143,7 +143,7 @@ grub_err_t
grub_loader_boot (void)
{
grub_err_t err = GRUB_ERR_NONE;
struct grub_preboot_t *cur;
struct grub_preboot *cur;
if (! grub_loader_loaded)
return grub_error (GRUB_ERR_NO_KERNEL, "no loaded kernel");

View file

@ -365,7 +365,7 @@ grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args)
}
static grub_extcmd_t cmd;
static void *preboot_hook;
static struct grub_preboot *preboot_hook;
GRUB_MOD_INIT (sendkey)
{

View file

@ -706,7 +706,7 @@ static struct grub_ata_dev grub_ahci_dev =
static void *fini_hnd;
static struct grub_preboot *fini_hnd;
GRUB_MOD_INIT(ahci)
{

View file

@ -191,7 +191,7 @@ grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
int handle __attribute__ ((unused)))
{
grub_err_t err;
static void *preb_handle = 0;
static struct grub_preboot *preb_handle = 0;
err = malloc_hook ();
if (err)

View file

@ -937,7 +937,7 @@ grub_net_restore_hw (void)
return GRUB_ERR_NONE;
}
static void *fini_hnd;
static struct grub_preboot *fini_hnd;
static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
static grub_command_t cmd_lsroutes, cmd_lscards;

View file

@ -56,11 +56,13 @@ typedef enum {
} grub_loader_preboot_hook_prio_t;
/* Register a preboot hook. */
void *EXPORT_FUNC(grub_loader_register_preboot_hook) (grub_err_t (*preboot_func) (int noret),
grub_err_t (*preboot_rest_func) (void),
grub_loader_preboot_hook_prio_t prio);
struct grub_preboot;
struct grub_preboot *EXPORT_FUNC(grub_loader_register_preboot_hook) (grub_err_t (*preboot_func) (int noret),
grub_err_t (*preboot_rest_func) (void),
grub_loader_preboot_hook_prio_t prio);
/* Unregister given preboot hook. */
void EXPORT_FUNC (grub_loader_unregister_preboot_hook) (void *hnd);
void EXPORT_FUNC (grub_loader_unregister_preboot_hook) (struct grub_preboot *hnd);
#endif /* ! GRUB_LOADER_HEADER */