sys/vfs/fuse: Cleanup (use TAILQ_FOREACH())
[dragonfly.git] / share / man / man9 / device_add_child.9
1 .\" Copyright (c) 1998 Doug Rabson
2 .\"
3 .\" All rights reserved.
4 .\"
5 .\" This program is free software.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 .\"
27 .\" $FreeBSD: src/share/man/man9/device_add_child.9,v 1.8.2.5 2001/12/17 11:30:18 ru Exp $
28 .\"
29 .Dd June 16, 1998
30 .Dt DEVICE_ADD_CHILD 9
31 .Os
32 .Sh NAME
33 .Nm device_add_child ,
34 .Nm device_add_child_ordered
35 .Nd "add a new device as a child of an existing device"
36 .Sh SYNOPSIS
37 .In sys/param.h
38 .In sys/bus.h
39 .Ft device_t
40 .Fn device_add_child "device_t dev" "const char *name" "int unit"
41 .Ft device_t
42 .Fn device_add_child_ordered "device_t dev" "int order" "const char *name" "int unit"
43 .Sh DESCRIPTION
44 Create a new child device of
45 .Fa dev .
46 The
47 .Fa name
48 and
49 .Fa unit
50 arguments specify the name and unit number of the device.
51 If the name is unknown then the caller should pass
52 .Dv NULL .
53 If the unit is unknown then the caller should pass
54 .Dv -1
55 and the system will choose the next available unit number.
56 .Pp
57 The name of the device is used to determine which drivers might be
58 appropriate for the device.  If a name is specified then only drivers
59 of that name are probed.  If no name is given then all drivers for the
60 owning bus are probed.
61 .Pp
62 This allows busses which can uniquely identify device instances (such
63 as PCI) to allow each driver to check each device instance for a
64 match.  For busses which rely on supplied probe hints where only one
65 driver can have a chance of probing the device, the driver name should
66 be specified as the device name.
67 .Pp
68 Normally unit numbers will be chosen automatically by the system and a
69 unit number of
70 .Dv -1
71 should be given.
72 When a specific unit number is desired (e.g. for wiring a particular
73 piece of hardware to a pre-configured unit number), that unit should
74 be passed.  If the specified unit number is already allocated, a new
75 unit will be allocated and a diagnostic message printed.
76 .Pp
77 If the devices attached to a bus must be probed in a specific order
78 (e.g. for the ISA bus some devices are sensitive to failed probe attempts
79 of unrelated drivers and therefore must be probed first),
80 the
81 .Fa order
82 argument of
83 .Fn device_add_child_ordered
84 should be used to specify a partial ordering.
85 The new device will be added before any existing device with a greater
86 order.
87 If
88 .Fn device_add_child
89 is used, then the new child will be added as if its order was zero.
90 .Sh RETURN VALUES
91 The new device if successful, NULL otherwise.
92 .Sh SEE ALSO
93 .Xr BUS_ADD_CHILD 9 ,
94 .Xr device 9
95 .Sh AUTHORS
96 This man page was written by
97 .An Doug Rabson .