|DEVFS_CLEAN(9F)||Kernel Functions for Drivers||DEVFS_CLEAN(9F)|
char *devnm, uint_t flags);
This is a private function that is not part of the stable DDI. It may be removed or changed at any time.
devfs_clean() function is used to clean up and detach devices from the system. While many device drivers may have one or more minor nodes created with ddi_create_minor_node(9F), some device drivers may have children devices with different device drivers attached. Each of these entries shows up in the file system of the global zone under /devices (see devfs(7FS)). These nodes are referred to as a devfs nodes (dv_node).
devfs caches unreferenced devfs nodes to
speed up the performance of
find, etc. The
function is used to cleanup cached nodes to reclaim memory as well as to
facilitate device removal (devfs nodes reference dev_info nodes, which
prevents driver from detaching).
devfs_clean() function starts
searching the tree rooted at dip. All directories
encountered are recursed through. If devnm is not
NULL, then it is used to limit the nodes that it searches. It compares the
name of the node, ignoring any part of the device's name that corresponds to
a minor node. If devnm has been specified, then
cleanup stops immediately after a busy devfs node has been encountered.
Not all nodes may be cleaned up when a driver calls the
devfs_clean() function. However, this is a non-fatal
situation. Callers should continue trying to offline devices as many holds
from userland processes may exist due to device contracts which will be
released when the device is offlined.
If a shell parks in a /devices directory,
the devfs node will be held, preventing the corresponding device to be
detached. This would be a denial of service against DR (dynamic
reconfiguration). To prevent this, DR code calls
devfs_clean() with the
devfs_clean() function always succeeds and returns zero.
|July 26, 2016||OmniOS|