stand: Move dev_cleanup into libsa

Since dev_cleanup() walks through all the devsw devices with dv_cleanup
rotuines, move it into libsa rather than having it in
'common'. Logically, it operates only on things that are in libsa, and
would never be different for different loaders: either people would call
it as is, or they'd do the loop themselves with 'special' things inline
between calls to cleanup (not that I think that will ever be needed
though).

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38004
This commit is contained in:
Warner Losh 2023-01-11 15:14:17 -07:00
parent 1c1783d66b
commit bf020787d5
4 changed files with 12 additions and 13 deletions

View File

@ -381,8 +381,6 @@ extern struct arch_switch archsw;
/* This must be provided by the MD code, but should it be in the archsw? */
void delay(int delay);
void dev_cleanup(void);
/*
* nvstore API.
*/

View File

@ -169,17 +169,6 @@ alloc_pread(readin_handle_t fd, off_t off, size_t len)
return (buf);
}
void
dev_cleanup(void)
{
int i;
/* Call cleanup routines */
for (i = 0; devsw[i] != NULL; ++i)
if (devsw[i]->dv_cleanup != NULL)
(devsw[i]->dv_cleanup)();
}
/*
* mount new rootfs and unmount old, set "currdev" environment variable.
*/

View File

@ -172,3 +172,14 @@ devinit(void)
}
return (err);
}
void
dev_cleanup(void)
{
int i;
/* Call cleanup routines */
for (i = 0; devsw[i] != NULL; ++i)
if (devsw[i]->dv_cleanup != NULL)
(devsw[i]->dv_cleanup)();
}

View File

@ -193,6 +193,7 @@ struct devdesc {
char *devformat(struct devdesc *d);
int devparse(struct devdesc **, const char *, const char **);
int devinit(void);
void dev_cleanup(void);
struct open_file {
int f_flags; /* see F_* below */