kldunload DIAGNOSTIC idea...

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Jul 21 04:37:51 PDT 2004


In message <1090408854.7114.8.camel at builder02.qubesoft.com>, Doug Rabson writes
:

>> There are three parts to it, a refcount on cdevsw which tells us if
>> any thread is inside the driver using that route, a refcount on the
>> individual cdev and a linkage between the two.
>
>The device_busy() counter is still simplest (as long as there is a
>device_t at all). The implementation of devclass_delete_driver() will
>automatically veto the unload (when its called from
>driver_module_handler()).

The problem is that I cannot find the device_t without dereferencing
the struct cdev (either for si_driver[12] or the dev_t) and by then
it is too late.  There is no way we can avoid refcounting on the cdev.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list