Add a cleanup function. This is needed for PXE where you should
shutdown the UNDI and unload the stack.
This commit is contained in:
parent
b86f592229
commit
4422f2d83b
@ -138,6 +138,7 @@ struct devsw {
|
||||
int (*dv_close)(struct open_file *f);
|
||||
int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data);
|
||||
void (*dv_print)(int verbose); /* print device information */
|
||||
void (*dv_cleanup)();
|
||||
};
|
||||
|
||||
extern int errno;
|
||||
|
@ -53,6 +53,7 @@ command_boot(int argc, char *argv[])
|
||||
struct loaded_module *km;
|
||||
char *cp;
|
||||
int try;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* See if the user has specified an explicit kernel to boot.
|
||||
@ -109,6 +110,11 @@ command_boot(int argc, char *argv[])
|
||||
if (archsw.arch_autoload() != 0)
|
||||
return(CMD_ERROR);
|
||||
|
||||
/* Call cleanup routines */
|
||||
for (i = 0; devsw[i] != NULL; ++i)
|
||||
if (devsw[i]->dv_cleanup != NULL)
|
||||
(devsw[i]->dv_cleanup)();
|
||||
|
||||
/* Call the exec handler from the loader matching the kernel */
|
||||
module_formats[km->m_loader]->l_exec(km);
|
||||
return(CMD_ERROR);
|
||||
|
@ -128,7 +128,8 @@ struct devsw pxedisk = {
|
||||
pxe_open,
|
||||
pxe_close,
|
||||
noioctl,
|
||||
pxe_print
|
||||
pxe_print,
|
||||
pxe_cleanup
|
||||
};
|
||||
|
||||
/*
|
||||
@ -325,14 +326,15 @@ pxe_cleanup(void)
|
||||
t_PXENV_UNDI_SHUTDOWN *undi_shutdown_p =
|
||||
(t_PXENV_UNDI_SHUTDOWN *)scratch_buffer;
|
||||
|
||||
pxe_call(PXENV_UNLOAD_STACK);
|
||||
if (unload_stack_p->Status != 0)
|
||||
panic("pxe_cleanup: UNLOAD_STACK failed");
|
||||
|
||||
pxe_call(PXENV_UNDI_SHUTDOWN);
|
||||
if (undi_shutdown_p->Status != 0)
|
||||
panic("pxe_cleanup: UNDI_SHUTDOWN failed");
|
||||
printf("All cleaned up!\n");
|
||||
panic("pxe_cleanup: UNDI_SHUTDOWN failed %x",
|
||||
undi_shutdown_p->Status);
|
||||
|
||||
pxe_call(PXENV_UNLOAD_STACK);
|
||||
if (unload_stack_p->Status != 0)
|
||||
panic("pxe_cleanup: UNLOAD_STACK failed %x",
|
||||
unload_stack_p->Status);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -225,6 +225,11 @@ COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot);
|
||||
static int
|
||||
command_reboot(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; devsw[i] != NULL; ++i)
|
||||
if (devsw[i]->dv_cleanup != NULL)
|
||||
(devsw[i]->dv_cleanup)();
|
||||
|
||||
printf("Rebooting...\n");
|
||||
delay(1000000);
|
||||
|
Loading…
Reference in New Issue
Block a user