Close cards before boot.

This commit is contained in:
Manoel R. Abranches 2011-06-18 20:18:25 -03:00
parent e23bc603f8
commit d6d205568f
4 changed files with 18 additions and 0 deletions

View file

@ -264,6 +264,8 @@ grub_machine_init (void)
void void
grub_machine_fini (void) grub_machine_fini (void)
{ {
if (grub_grubnet_fini)
grub_grubnet_fini ();
grub_ofdisk_fini (); grub_ofdisk_fini ();
grub_console_fini (); grub_console_fini ();
} }

View file

@ -225,6 +225,10 @@ GRUB_MOD_INIT(ofnet)
GRUB_MOD_FINI(ofnet) GRUB_MOD_FINI(ofnet)
{ {
struct grub_net_card *card;
FOR_NET_CARDS (card)
if (card->driver && !grub_strcmp (card->driver->name, "ofnet"))
card->driver->fini (card);
grub_net_card_driver_unregister (&ofdriver); grub_net_card_driver_unregister (&ofdriver);
grub_getbootp = NULL; grub_getbootp = NULL;
} }

View file

@ -1021,6 +1021,15 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
"unrecognised format specification %s", args[3]); "unrecognised format specification %s", args[3]);
} }
static void
grub_grubnet_fini_real (void)
{
struct grub_net_card *card;
FOR_NET_CARDS (card)
if (card->driver)
card->driver->fini (card);
}
static struct grub_fs grub_net_fs = static struct grub_fs grub_net_fs =
{ {
.name = "netfs", .name = "netfs",
@ -1060,6 +1069,7 @@ GRUB_MOD_INIT(net)
grub_fs_register (&grub_net_fs); grub_fs_register (&grub_net_fs);
grub_net_open = grub_net_open_real; grub_net_open = grub_net_open_real;
grub_file_net_seek = grub_net_seek_real; grub_file_net_seek = grub_net_seek_real;
grub_grubnet_fini = grub_grubnet_fini_real;
} }
GRUB_MOD_FINI(net) GRUB_MOD_FINI(net)
@ -1074,4 +1084,5 @@ GRUB_MOD_FINI(net)
grub_fs_unregister (&grub_net_fs); grub_fs_unregister (&grub_net_fs);
grub_net_open = NULL; grub_net_open = NULL;
grub_file_net_seek = NULL; grub_file_net_seek = NULL;
grub_grubnet_fini = NULL;
} }

View file

@ -239,6 +239,7 @@ typedef struct grub_net
extern grub_net_t (*EXPORT_VAR (grub_net_open)) (const char *name); extern grub_net_t (*EXPORT_VAR (grub_net_open)) (const char *name);
extern grub_err_t (*EXPORT_VAR (grub_file_net_seek)) (struct grub_file *file, grub_off_t offset); extern grub_err_t (*EXPORT_VAR (grub_file_net_seek)) (struct grub_file *file, grub_off_t offset);
void (*EXPORT_VAR (grub_grubnet_fini)) (void);
struct grub_net_network_level_interface struct grub_net_network_level_interface
{ {