Main index | Section 9 | Options |
#include <sys/param.h>
#include <sys/conf.h>
If successful, dev_refthread() and devvn_refthread() acquire a "thread reference" to the associated struct cdev and return a non-NULL pointer to the cdev's struct cdevsw method table. For the duration of that reference, the cdev's associated private data and method table object are valid. Destruction of the cdev sleeps until the thread reference is released.
A reference cannot prevent media removal. It is an implementation detail of individual drivers how method calls from callers with dev_refthread() references are handled when the device is pending destruction. A common behavior for disk devices is to return the ENXIO status, but that is not required by this KPI.
The devvn_refthread() variant of dev_refthread() extracts the struct cdev pointer out of the VCHR vnode(9) automatically before performing the same actions as dev_refthread(). Additionally, a pointer to the struct cdev is returned to the caller via *devp. devvn_refthread() correctly handles possible parallel reclamation of the vnode.
dev_relthread() is used to release a reference to a struct cdev. dev_relthread() must only be invoked when the associated invocation of dev_refthread() or devvn_refthread() returned a non-NULL struct cdevsw *.
DEV_REFTHREAD (9) | August 29, 2018 |
Main index | Section 9 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.