2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2008 Sun Microsystems, Inc. All rights reserved.
13 .\" Copyright 2016 Nexenta Systems, Inc.
20 .Nd destroy unreferenced devfs nodes and detach devices
33 This is a private function that is not part of the stable DDI.
34 It may be removed or changed at any time.
38 A pointer to the device's
41 Clean up is rooted at this device.
43 An optional character string used to restrict the devfs nodes list.
45 The following flag is supported:
46 .Bl -tag -width "DV_CLEAN_FORCE"
48 force clean of referenced directories, referenced empty directories are marked
49 as stale to facilitate DR
50 .Pq dynamic reconfiguration
56 function is used to clean up and detach devices from the system.
57 While many device drivers may have one or more minor nodes created with
58 .Xr ddi_create_minor_node 9F ,
59 some device drivers may have children devices with different device drivers
61 Each of these entries shows up in the file system of the global zone under
66 These nodes are referred to as a devfs nodes
70 caches unreferenced devfs nodes to speed up the performance of
76 function is used to cleanup cached nodes to reclaim memory as well as to
77 facilitate device removal
78 .Pq devfs nodes reference dev_info nodes, which prevents driver from detaching .
82 function starts searching the tree rooted at
84 All directories encountered are recursed through.
87 is not NULL, then it is used to limit the nodes that it searches.
88 It compares the name of the node, ignoring any part of the device's name that
89 corresponds to a minor node.
92 has been specified, then cleanup stops immediately after a busy devfs node has
95 Not all nodes may be cleaned up when a driver calls the
98 However, this is a non-fatal situation.
99 Callers should continue trying to offline devices as many holds from userland
100 processes may exist due to device contracts which will be released when the
103 If a shell parks in a
105 directory, the devfs node will be held, preventing the corresponding device to
107 This would be a denial of service against DR (dynamic reconfiguration).
108 To prevent this, DR code calls
114 This function may be called in user or kernel context.
118 function always succeeds and returns zero.