Use count in open/close device driver
yong rao
yrao at force10networks.com
Thu Aug 28 17:06:32 UTC 2008
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.
More information about the freebsd-drivers
mailing list