PHYSIO(9) BSD Kernel Manual PHYSIO(9)
physio - initiate I/O on raw devices
int physio(void (*strategy)(struct buf *), struct buf *bp, dev_t dev, int flags, void (*minphys)(struct buf *), struct uio *uio);
physio() is a helper function typically called from character device read and write routines to start I/O on a user process buffer. It calls back on the provided strategy routine one or more times to complete the transfer described by uio. The maximum amount of data to transfer with each call to strategy is determined by the minphys routine. Since uio normally describes user space addresses, physio() needs to lock the ap- propriate data area into memory before each transaction with strategy (see the uvm_vslock() and uvm_vsunlock() functions in uvm(9)). physio() always awaits the completion of the entire requested transfer before re- turning, unless an error condition is detected earlier. In all cases, the buffer passed in bp is locked (marked as "busy") for the duration of the entire transfer. A break-down of the arguments follows: strategy The device strategy routine to call for each chunk of data to in- itiate device I/O. bp The buffer to use with the strategy routine. The buffer flags will have B_BUSY, B_PHYS, and B_RAW set when passed to the stra- tegy routine. If NULL, a buffer is allocated from a system pool. dev The device number identifying the device to interact with. flags Direction of transfer; the only valid settings are B_READ or B_WRITE. minphys A device specific routine called to determine the maximum transfer size that the device's strategy routine can handle. uio The description of the entire transfer as requested by the user process. Currently, the results of passing a uio structure with the 'uio_segflg' set to anything other than UIO_USERSPACE, are undefined.
If successful, physio() returns 0. EFAULT is returned if the address range described by uio is not accessible by the requesting process. phy- sio() will return any error resulting from calls to the device strategy routine, by examining the B_ERROR buffer flag and the 'b_error' field. Note that the actual transfer size may be less than requested by uio if the device signals an "end of file" condition.
read(2), write(2) MirOS BSD #10-current June 15, 1996 1
Generated on 2013-10-31 22:57:03 by $MirOS: src/scripts/roff2htm,v 1.77 2013/01/01 20:49:09 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2013 The MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.