xref: /freebsd/share/man/man9/physio.9 (revision 5dc6c3a38af26ef5624c3561422a8311afe12d81)
14b2502a3SMike Pritchard.\"	$NetBSD: physio.9,v 1.2 1996/11/11 00:05:12 lukem Exp $
24b2502a3SMike Pritchard.\"
34b2502a3SMike Pritchard.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
44b2502a3SMike Pritchard.\" All rights reserved.
54b2502a3SMike Pritchard.\"
64b2502a3SMike Pritchard.\" This code is derived from software contributed to The NetBSD Foundation
74b2502a3SMike Pritchard.\" by Paul Kranenburg.
84b2502a3SMike Pritchard.\"
94b2502a3SMike Pritchard.\" Redistribution and use in source and binary forms, with or without
104b2502a3SMike Pritchard.\" modification, are permitted provided that the following conditions
114b2502a3SMike Pritchard.\" are met:
124b2502a3SMike Pritchard.\" 1. Redistributions of source code must retain the above copyright
134b2502a3SMike Pritchard.\"    notice, this list of conditions and the following disclaimer.
144b2502a3SMike Pritchard.\" 2. Redistributions in binary form must reproduce the above copyright
154b2502a3SMike Pritchard.\"    notice, this list of conditions and the following disclaimer in the
164b2502a3SMike Pritchard.\"    documentation and/or other materials provided with the distribution.
174b2502a3SMike Pritchard.\"
184b2502a3SMike Pritchard.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
194b2502a3SMike Pritchard.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
204b2502a3SMike Pritchard.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
214b2502a3SMike Pritchard.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
224b2502a3SMike Pritchard.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
234b2502a3SMike Pritchard.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
244b2502a3SMike Pritchard.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
254b2502a3SMike Pritchard.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
264b2502a3SMike Pritchard.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
274b2502a3SMike Pritchard.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
284b2502a3SMike Pritchard.\" POSSIBILITY OF SUCH DAMAGE.
294b2502a3SMike Pritchard.\"
307f3dea24SPeter Wemm.\" $FreeBSD$
315bf6ab83SNik Clayton.\"
32*5dc6c3a3SEd Schouten.Dd January 19, 2012
334b2502a3SMike Pritchard.Dt PHYSIO 9
343d45e180SRuslan Ermilov.Os
354b2502a3SMike Pritchard.Sh NAME
364b2502a3SMike Pritchard.Nm physio
374b2502a3SMike Pritchard.Nd initiate I/O on raw devices
384b2502a3SMike Pritchard.Sh SYNOPSIS
3932eef9aeSRuslan Ermilov.In sys/param.h
4032eef9aeSRuslan Ermilov.In sys/systm.h
41f16b3c0dSChad David.In sys/bio.h
4232eef9aeSRuslan Ermilov.In sys/buf.h
434b2502a3SMike Pritchard.Ft int
44*5dc6c3a3SEd Schouten.Fn physio "struct cdev *dev" "struct uio *uio" "int ioflag"
454b2502a3SMike Pritchard.Sh DESCRIPTION
464b2502a3SMike PritchardThe
474b2502a3SMike Pritchard.Fn physio
48b6acc60dSRuslan Ermilovis a helper function typically called from character device
49b6acc60dSRuslan Ermilov.Fn read
50b6acc60dSRuslan Ermilovand
51b6acc60dSRuslan Ermilov.Fn write
521111b49cSSheldon Hearnroutines to start I/O on a user process buffer.
53e1051231SJosef KarthauserThe maximum amount of data to transfer with each call
54b6acc60dSRuslan Ermilovis determined by
55b6acc60dSRuslan Ermilov.Fa dev->si_iosize_max .
56cd4d01d8SWarner LoshThe
57cd4d01d8SWarner Losh.Fn physio
58cd4d01d8SWarner Loshcall converts the I/O request into a
59cd4d01d8SWarner Losh.Fn strategy
60cd4d01d8SWarner Loshrequest and passes the new request to the driver's
61cd4d01d8SWarner Losh.Fn strategy
62cd4d01d8SWarner Loshroutine for processing.
63e1051231SJosef Karthauser.Pp
641111b49cSSheldon HearnSince
654b2502a3SMike Pritchard.Fa uio
664b2502a3SMike Pritchardnormally describes user space addresses,
674b2502a3SMike Pritchard.Fn physio
68c0854fb7SRuslan Ermilovneeds to lock those pages into memory.
69cd4d01d8SWarner LoshThis is done by calling
70cd4d01d8SWarner Losh.Fn vmapbuf
71cd4d01d8SWarner Loshfor the appropriate pages.
724b2502a3SMike Pritchard.Fn physio
734b2502a3SMike Pritchardalways awaits the completion of the entire requested transfer before
741111b49cSSheldon Hearnreturning, unless an error condition is detected earlier.
754b2502a3SMike Pritchard.Pp
764b2502a3SMike PritchardA break-down of the arguments follows:
774b2502a3SMike Pritchard.Bl -tag -width indent
784b2502a3SMike Pritchard.It Fa dev
794b2502a3SMike PritchardThe device number identifying the device to interact with.
804b2502a3SMike Pritchard.It Fa uio
814b2502a3SMike PritchardThe description of the entire transfer as requested by the user process.
824b2502a3SMike PritchardCurrently, the results of passing a
834b2502a3SMike Pritchard.Fa uio
844b2502a3SMike Pritchardstructure with the
85b6acc60dSRuslan Ermilov.Va uio_segflg
864b2502a3SMike Pritchardset to anything other than
87b6acc60dSRuslan Ermilov.Dv UIO_USERSPACE
884b2502a3SMike Pritchardare undefined.
89cd4d01d8SWarner Losh.It Fa ioflag
90cd4d01d8SWarner LoshThe ioflag argument from the
91cd4d01d8SWarner Losh.Fn read
92cd4d01d8SWarner Loshor
93cd4d01d8SWarner Losh.Fn write
94cd4d01d8SWarner Loshfunction calling
95cd4d01d8SWarner Losh.Fn physio .
964b2502a3SMike Pritchard.El
974b2502a3SMike Pritchard.Sh RETURN VALUES
984b2502a3SMike PritchardIf successful
994b2502a3SMike Pritchard.Fn physio
1004b2502a3SMike Pritchardreturns 0.
1014b2502a3SMike Pritchard.Er EFAULT
1024b2502a3SMike Pritchardis returned if the address range described by
1034b2502a3SMike Pritchard.Fa uio
1044b2502a3SMike Pritchardis not accessible by the requesting process.
1054b2502a3SMike Pritchard.Fn physio
1064b2502a3SMike Pritchardwill return any error resulting from calls to the device strategy routine,
1074b2502a3SMike Pritchardby examining the
1084b2502a3SMike Pritchard.Dv B_ERROR
1094b2502a3SMike Pritchardbuffer flag and the
1104b2502a3SMike Pritchard.Va b_error
1111111b49cSSheldon Hearnfield.
1121111b49cSSheldon HearnNote that the actual transfer size may be less than requested by
1134b2502a3SMike Pritchard.Fa uio
1144b2502a3SMike Pritchardif the device signals an
115b6acc60dSRuslan Ermilov.Dq "end of file"
1164b2502a3SMike Pritchardcondition.
1174b2502a3SMike Pritchard.Sh SEE ALSO
1184b2502a3SMike Pritchard.Xr read 2 ,
1194b2502a3SMike Pritchard.Xr write 2
120e1051231SJosef Karthauser.Sh HISTORY
121e1051231SJosef KarthauserThe
122b6acc60dSRuslan Ermilov.Nm
123b6acc60dSRuslan Ermilovmanual page is originally from
124b6acc60dSRuslan Ermilov.Nx
125b6acc60dSRuslan Ermilovwith minor changes for applicability with
126b6acc60dSRuslan Ermilov.Fx .
127e1051231SJosef Karthauser.Pp
128b6acc60dSRuslan ErmilovThe
129b6acc60dSRuslan Ermilov.Nm
130b6acc60dSRuslan Ermilovcall has been completely re-written for providing higher
1318fb2b565SHiten PandyaI/O and paging performance.
132