summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2002-02-16 17:35:05 +0000
committergreen <green@FreeBSD.org>2002-02-16 17:35:05 +0000
commit5c8476e5d9fdf9e081e9a77169f6d47581defbb6 (patch)
treef42e6cd36c9961566807228309df5c73c96f32b5
parentcfada7e2ddee51c5f8633c21aaab54d1945ab950 (diff)
downloadFreeBSD-src-5c8476e5d9fdf9e081e9a77169f6d47581defbb6.zip
FreeBSD-src-5c8476e5d9fdf9e081e9a77169f6d47581defbb6.tar.gz
Add revoke_and_destroy_dev(), to be used by devices which decide when
they choose to destroy themselves without regard to whether or not they are open.
-rw-r--r--sys/kern/kern_conf.c13
-rw-r--r--sys/sys/conf.h1
-rw-r--r--sys/sys/linedisc.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index a9264a2..4263f92 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -362,6 +362,19 @@ make_dev_alias(dev_t pdev, const char *fmt, ...)
}
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 f2bba3a..130f5cb 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 f2bba3a..130f5cb 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));
OpenPOWER on IntegriCloud