Kernel - Completely remove DFLTPHYS
[dragonfly.git] / share / man / man9 / physio.9
1 .\"
2 .\" Copyright (c) 2005 The DragonFly Project.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to The DragonFly Project
5 .\" by Hiten Pandya <hmp@backplane.com>.
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 .\"
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in
15 .\"    the documentation and/or other materials provided with the
16 .\"    distribution.
17 .\" 3. Neither the name of The DragonFly Project nor the names of its
18 .\"    contributors may be used to endorse or promote products derived
19 .\"    from this software without specific, prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" SUCH DAMAGE.
33 .\"
34 .\"     $NetBSD: physio.9,v 1.2 1996/11/11 00:05:12 lukem Exp $
35 .\"
36 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
37 .\" All rights reserved.
38 .\"
39 .\" This code is derived from software contributed to The NetBSD Foundation
40 .\" by Paul Kranenburg.
41 .\"
42 .\" Redistribution and use in source and binary forms, with or without
43 .\" modification, are permitted provided that the following conditions
44 .\" are met:
45 .\" 1. Redistributions of source code must retain the above copyright
46 .\"    notice, this list of conditions and the following disclaimer.
47 .\" 2. Redistributions in binary form must reproduce the above copyright
48 .\"    notice, this list of conditions and the following disclaimer in the
49 .\"    documentation and/or other materials provided with the distribution.
50 .\" 3. All advertising materials mentioning features or use of this software
51 .\"    must display the following acknowledgement:
52 .\"        This product includes software developed by the NetBSD
53 .\"        Foundation, Inc. and its contributors.
54 .\" 4. Neither the name of The NetBSD Foundation nor the names of its
55 .\"    contributors may be used to endorse or promote products derived
56 .\"    from this software without specific prior written permission.
57 .\"
58 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
59 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
60 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
61 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
62 .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
63 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
64 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
65 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
66 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
67 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
68 .\" POSSIBILITY OF SUCH DAMAGE.
69 .\"
70 .\" $FreeBSD: src/share/man/man9/physio.9,v 1.6.2.4 2001/12/17 11:30:18 ru Exp $
71 .\" $DragonFly: src/share/man/man9/physio.9,v 1.5 2008/11/09 10:59:14 swildner Exp $
72 .\"
73 .Dd November 9, 2008
74 .Dt PHYSIO 9
75 .Os
76 .Sh NAME
77 .Nm physread ,
78 .Nm physwrite
79 .Nd initiate I/O on raw devices
80 .Sh SYNOPSIS
81 .In sys/buf.h
82 .In sys/device.h
83 .Ft int
84 .Fn physread "struct dev_read_args *ap"
85 .Ft int
86 .Fn physwrite "struct dev_write_args *ap"
87 .Sh DESCRIPTION
88 .Fn Physread
89 and
90 .Fn physwrite
91 are helper functions typically called from character device read and write
92 routines to start I/O on a user process buffer.
93 They will call the
94 .Fn dev_dstrategy
95 routine one or more times depending on the size of transfer which is
96 described by the
97 .Fa ap
98 argument.
99 .Pp
100 The maximum amount of data transferable in one iteration of the
101 .Fn physread
102 and
103 .Fn physwrite
104 functions is determined by the maximum I/O size supported by the device
105 .Fa dev ,
106 otherwise the value of
107 .Dv MAXPHYS
108 is used.
109 Until the I/O operation is complete, the calling process or thread is
110 put to sleep with the wait message set to
111 .Ql "physstr" .
112 .Pp
113 The
114 .Fn physread
115 and
116 .Fn physwrite
117 functions always await the completion of the entire requested transfer
118 before returning, unless an error condition is detected earlier.
119 .Pp
120 The
121 .Fa ap
122 argument is a pointer to a
123 .Vt dev_read_args
124 or
125 .Vt dev_write_args
126 structure, as passed to
127 .Nm d_read
128 or
129 .Nm d_write .
130 .Sh RETURN VALUES
131 If successful
132 .Fn physread
133 and
134 .Fn physwrite
135 will return 0.
136 .Pp
137 The
138 .Va errno
139 value
140 .Er EFAULT
141 will be returned if the address range described by
142 .Fa uio
143 is not accessible by the calling process or thread.
144 .Pp
145 Note that the actual transfer size may be less than requested by
146 .Fa ap
147 if the device signals an
148 .Dq end of file
149 condition.
150 .Sh SEE ALSO
151 .Xr read 2 ,
152 .Xr write 2 ,
153 .Xr uio 9