summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_conf.c
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>1999-06-25 07:49:01 +0000
committergrog <grog@FreeBSD.org>1999-06-25 07:49:01 +0000
commit700cc4b9df826524cd42ec50162207d169797fc8 (patch)
treea657474f703a0cff37af8c99c379c5754bdbeef1 /sys/kern/kern_conf.c
parent9324a238d272e87b3263fa08d100f7124ee4a748 (diff)
downloadFreeBSD-src-700cc4b9df826524cd42ec50162207d169797fc8.zip
FreeBSD-src-700cc4b9df826524cd42ec50162207d169797fc8.tar.gz
Add function cdevsw_remove, the opposite of cdevsw_add: remove an
entry in cdevsw (and bdevsw if appropriate). Reviewed-by: phk
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r--sys/kern/kern_conf.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index 2bc5fa1..39ad020 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_conf.c,v 1.42 1999/06/01 18:56:24 phk Exp $
+ * $Id: kern_conf.c,v 1.43 1999/06/01 20:41:26 dt Exp $
*/
#include <sys/param.h>
@@ -120,6 +120,27 @@ cdevsw_add(struct cdevsw *newentry)
return 0;
}
+/*
+ * Remove a cdevsw entry
+ */
+
+int
+cdevsw_remove(struct cdevsw *oldentry)
+{
+ if (oldentry->d_maj < 0 || oldentry->d_maj >= NUMCDEVSW) {
+ printf("%s: ERROR: driver has bogus cdevsw->d_maj = %d\n",
+ oldentry->d_name, oldentry->d_maj);
+ return EINVAL;
+ }
+
+ cdevsw[oldentry->d_maj] = NULL;
+
+ if (oldentry->d_bmaj >= 0 && oldentry->d_bmaj < NUMCDEVSW)
+ bmaj2cmaj[oldentry->d_bmaj] = NULL;
+
+ return 0;
+}
+
int
devsw_module_handler(module_t mod, int what, void* arg)
{
OpenPOWER on IntegriCloud