Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Aug 2008 09:43:28 -0700 (PDT)
From:      yong rao <yrao@force10networks.com>
To:        freebsd-drivers@freebsd.org
Subject:   Use count in open/close device driver
Message-ID:  <19204481.post@talk.nabble.com>

index | next in thread | raw e-mail


We want to have use count in the dev_open(), dev_close() functions. Just like
in Linux, in open_dev() function we counld have 

  #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
        MOD_INC_USE_COUNT;
  #endif

  #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
   try_module_get(THIS_MODULE);    /* increment the usage counter */
 #endif

to increment the use count. In close_dev(), we could decrement the use
count.

So, when the device driver is unloaded, we would be able to know if there is
any other application processes is still using the driver.

Is there anybody having any clues?

Thanks a lot,

Yong Rao

-- 
View this message in context: http://www.nabble.com/Use-count-in-open-close-device-driver-tp19204481p19204481.html
Sent from the freebsd-drivers mailing list archive at Nabble.com.



help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19204481.post>