summaryrefslogtreecommitdiffstats
path: root/sys
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
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')
-rw-r--r--sys/kern/kern_conf.c23
-rw-r--r--sys/sys/conf.h3
-rw-r--r--sys/sys/linedisc.h3
3 files changed, 26 insertions, 3 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)
{
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index ad96a24..5fffcdb 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $Id: conf.h,v 1.58 1999/05/31 11:29:08 phk Exp $
+ * $Id: conf.h,v 1.59 1999/06/01 18:56:26 phk Exp $
*/
#ifndef _SYS_CONF_H_
@@ -221,6 +221,7 @@ DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+cmaj*256+bmaj)
struct cdevsw *bdevsw __P((dev_t dev));
int cdevsw_add __P((struct cdevsw *new));
+int cdevsw_remove __P((struct cdevsw *old));
dev_t chrtoblk __P((dev_t dev));
struct cdevsw *devsw __P((dev_t dev));
int devsw_module_handler __P((struct module *mod, int what, void *arg));
diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h
index ad96a24..5fffcdb 100644
--- a/sys/sys/linedisc.h
+++ b/sys/sys/linedisc.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $Id: conf.h,v 1.58 1999/05/31 11:29:08 phk Exp $
+ * $Id: conf.h,v 1.59 1999/06/01 18:56:26 phk Exp $
*/
#ifndef _SYS_CONF_H_
@@ -221,6 +221,7 @@ DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+cmaj*256+bmaj)
struct cdevsw *bdevsw __P((dev_t dev));
int cdevsw_add __P((struct cdevsw *new));
+int cdevsw_remove __P((struct cdevsw *old));
dev_t chrtoblk __P((dev_t dev));
struct cdevsw *devsw __P((dev_t dev));
int devsw_module_handler __P((struct module *mod, int what, void *arg));
OpenPOWER on IntegriCloud