diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index a9264a252f28..4263f92db32b 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -361,6 +361,19 @@ make_dev_alias(dev_t pdev, const char *fmt, ...) return (dev); } +void +revoke_and_destroy_dev(dev_t dev) +{ + struct vnode *vp; + + GIANT_REQUIRED; + + vp = SLIST_FIRST(&dev->si_hlist); + if (vp != NULL) + VOP_REVOKE(vp, REVOKEALL); + destroy_dev(dev); +} + void destroy_dev(dev_t dev) { diff --git a/sys/sys/conf.h b/sys/sys/conf.h index f2bba3a55d67..130f5cb155c3 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -317,6 +317,7 @@ int cdevsw_add __P((struct cdevsw *new)); int cdevsw_remove __P((struct cdevsw *old)); int count_dev __P((dev_t dev)); void destroy_dev __P((dev_t dev)); +void revoke_and_destroy_dev __P((dev_t dev)); struct cdevsw *devsw __P((dev_t dev)); const char *devtoname __P((dev_t dev)); int dev_named __P((dev_t pdev, const char *name)); diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h index f2bba3a55d67..130f5cb155c3 100644 --- a/sys/sys/linedisc.h +++ b/sys/sys/linedisc.h @@ -317,6 +317,7 @@ int cdevsw_add __P((struct cdevsw *new)); int cdevsw_remove __P((struct cdevsw *old)); int count_dev __P((dev_t dev)); void destroy_dev __P((dev_t dev)); +void revoke_and_destroy_dev __P((dev_t dev)); struct cdevsw *devsw __P((dev_t dev)); const char *devtoname __P((dev_t dev)); int dev_named __P((dev_t pdev, const char *name));