From ca46420989e2b4aa106c5398ab5c18c6b1805609 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 17 May 2007 03:02:00 +0000 Subject: [PATCH] Add dev_drefs() - return the number of references on a cdev_t --- sys/kern/kern_device.c | 8 +++++++- sys/sys/device.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_device.c b/sys/kern/kern_device.c index 8f2b871c2a..012a51bc6b 100644 --- a/sys/kern/kern_device.c +++ b/sys/kern/kern_device.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_device.c,v 1.25 2007/05/15 22:44:14 dillon Exp $ + * $DragonFly: src/sys/kern/kern_device.c,v 1.26 2007/05/17 03:01:59 dillon Exp $ */ #include #include @@ -300,6 +300,12 @@ dev_dkqfilter(cdev_t dev, struct knote *kn) * DEVICE HELPER FUNCTIONS * ************************************************************************/ +int +dev_drefs(cdev_t dev) +{ + return(dev->si_sysref.refcnt); +} + const char * dev_dname(cdev_t dev) { diff --git a/sys/sys/device.h b/sys/sys/device.h index 2b6f7ecbd9..3b55b746be 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/sys/device.h,v 1.10 2007/05/15 22:44:19 dillon Exp $ + * $DragonFly: src/sys/sys/device.h,v 1.11 2007/05/17 03:02:00 dillon Exp $ */ #ifndef _SYS_DEVICE_H_ @@ -292,6 +292,7 @@ int dev_dkqfilter(cdev_t dev, struct knote *kn); int dev_dmmap(cdev_t dev, vm_offset_t offset, int nprot); int dev_dclone(cdev_t dev); +int dev_drefs(cdev_t dev); const char *dev_dname(cdev_t dev); int dev_dmaj(cdev_t dev); int dev_dflags(cdev_t dev); -- 2.41.0