git: bf020787d5f1 - main - stand: Move dev_cleanup into libsa
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 Jan 2023 22:17:12 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=bf020787d5f1b4a1274135b49309f7e9ef3955e1
commit bf020787d5f1b4a1274135b49309f7e9ef3955e1
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-01-11 22:14:17 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-11 22:15:14 +0000
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
---
stand/common/bootstrap.h | 2 --
stand/common/misc.c | 11 -----------
stand/libsa/dev.c | 11 +++++++++++
stand/libsa/stand.h | 1 +
4 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h
index b16625774ce5..138e2e51ceff 100644
--- a/stand/common/bootstrap.h
+++ b/stand/common/bootstrap.h
@@ -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.
*/
diff --git a/stand/common/misc.c b/stand/common/misc.c
index e1945b24be5a..e27191796a72 100644
--- a/stand/common/misc.c
+++ b/stand/common/misc.c
@@ -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.
*/
diff --git a/stand/libsa/dev.c b/stand/libsa/dev.c
index b273edb4457e..6d1834c8a14a 100644
--- a/stand/libsa/dev.c
+++ b/stand/libsa/dev.c
@@ -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)();
+}
diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h
index b5087d17e114..87b86fb98b20 100644
--- a/stand/libsa/stand.h
+++ b/stand/libsa/stand.h
@@ -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 */