1physio(9F)               Kernel Functions for Drivers               physio(9F)
2
3
4

NAME

6       physio, minphys - perform physical I/O
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/buf.h>
11       #include <sys/uio.h>
12
13
14
15       int physio(int(*strat)(struct buf *), struct buf *bp, dev_t dev,
16            int rw, void (*mincnt)(struct buf *), struct uio *uio);
17
18
19       void minphys(struct buf *bp);
20
21

INTERFACE LEVEL

23       Solaris DDI specific (Solaris DDI).
24

PARAMETERS

26   physio()
27       strat      Pointer to device strategy routine.
28
29
30       bp         Pointer  to  a buf(9S) structure describing the transfer. If
31                  bp is set to NULL then physio() allocates one which is auto‐
32                  matically released upon completion.
33
34
35       dev        The device number.
36
37
38       rw         Read/write flag. This is either B_READ when reading from the
39                  device, or B_WRITE when writing to the device.
40
41
42       mincnt     Routine which bounds the maximum transfer unit size.
43
44
45       uio        Pointer to the uio structure which describes  the  user  I/O
46                  request.
47
48
49   minphys()
50       bp     Pointer to a buf structure.
51
52

DESCRIPTION

54       physio()  performs unbuffered I/O operations between the device dev and
55       the address space described in the uio structure.
56
57
58       Prior to the start of the  transfer  physio()  verifies  the  requested
59       operation  is  valid  by  checking  the protection of the address space
60       specified in the uio structure. It then locks the pages involved in the
61       I/O transfer so they can not be paged out. The device strategy routine,
62       strat(), is then called one or more times to perform the  physical  I/O
63       operations.  physio()  uses biowait(9F) to block until strat() has com‐
64       pleted each transfer.  Upon  completion,  or  detection  of  an  error,
65       physio() unlocks the pages and returns the error status.
66
67
68       physio()  uses  mincnt() to bound the maximum transfer unit size to the
69       system, or device, maximum length. minphys()  is  the  system  mincnt()
70       routine  for use with physio() operations. Drivers which do not provide
71       their own local mincnt() routines should call physio() with minphys().
72
73
74       minphys() limits the value of bp->b_bcount to a  sensible  default  for
75       the capabilities of the system. Drivers that provide their own mincnt()
76       routine should also call minphys() to make sure they do not exceed  the
77       system limit.
78

RETURN VALUES

80       physio() returns:
81
82       0           Upon success.
83
84
85       non-zero    Upon failure.
86
87

CONTEXT

89       physio() can be called from user context only.
90

SEE ALSO

92       strategy(9E), biodone(9F), biowait(9F), buf(9S), uio(9S)
93
94
95       Writing Device Drivers
96

WARNINGS

98       Since physio() calls biowait() to block until each buf transfer is com‐
99       plete, it is the drivers responsibility to call  biodone(9F)  when  the
100       transfer is complete, or physio() will block forever.
101
102
103
104SunOS 5.11                        2 Apr 1993                        physio(9F)
Impressum