diff options
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r-- | sys/kern/kern_conf.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 46fca85..e3e9495 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -84,12 +84,14 @@ dev_lock(void) void dev_unlock(void) { + mtx_unlock(&devmtx); } void dev_ref(struct cdev *dev) { + dev_lock(); dev->si_refcount++; dev_unlock(); @@ -107,6 +109,29 @@ dev_rel(struct cdev *dev) freedev(dev); } } +struct cdevsw * +dev_refthread(struct cdev *dev) +{ + struct cdevsw *csw; + + mtx_assert(&devmtx, MA_NOTOWNED); + dev_lock(); + csw = dev->si_devsw; + if (csw != NULL) + dev->si_threadcount++; + dev_unlock(); + return (csw); +} + +void +dev_relthread(struct cdev *dev) +{ + + mtx_assert(&devmtx, MA_NOTOWNED); + dev_lock(); + dev->si_threadcount--; + dev_unlock(); +} int nullop(void) |