1awrite(9E)                    Driver Entry Points                   awrite(9E)
2
3
4

NAME

6       awrite - asynchronous write to a device
7

SYNOPSIS

9       #include <sys/uio.h>
10       #include <sys/aio_req.h>
11       #include <sys/cred.h>
12       #include <sys/ddi.h>
13       #include <sys/sunddi.h>
14
15       intprefixawrite(dev_t dev, struct aio_req *aio_reqp,
16            cred_t *cred_p);
17
18

INTERFACE LEVEL

20       Solaris DDI specific (Solaris DDI). This entry point is optional. Driv‐
21       ers that do not support an  awrite() entry point should use  nodev(9F)
22

PARAMETERS

24       dev         Device number.
25
26
27       aio_reqp    Pointer to the  aio_req(9S) structure that describes  where
28                   the data is stored.
29
30
31       cred_p      Pointer to the  credential structure.
32
33

DESCRIPTION

35       The  driver's  awrite()  routine  is  called to perform an asynchronous
36       write. getminor(9F) can be used to  access the minor  number  component
37       of the dev argument. awrite() may use the  credential structure pointed
38       to by  cred_p to check for superuser access by  calling   drv_priv(9F).
39       The   awrite()  routine may also examine the  uio(9S) structure through
40       the   aio_req  structure  pointer,   aio_reqp.   awrite()   must   call
41       aphysio(9F)  with  the  aio_req  pointer  and a pointer to the driver's
42       strategy(9E) routine.
43
44
45       No fields of the uio(9S) structure pointed to by  aio_req,  other  than
46       uio_offset or uio_loffset, may be modified for non-seekable devices.
47

RETURN VALUES

49       The  awrite() routine should return   0 for success, or the appropriate
50       error number.
51

CONTEXT

53       This function is called from user context only.
54

EXAMPLES

56       Example 1 Using the awrite() routine:
57
58
59       The following is an example of an  awrite() routine:
60
61
62         static int
63         xxawrite(dev_t dev, struct aio_req *aio, cred_t *cred_p)
64         {
65                 int instance;
66                 struct xxstate *xsp;
67
68                 instance = getminor(dev);
69                 xsp = ddi_get_soft_state(statep, instance);
70                 /*Verify soft state structure has been allocated */
71                 if (xsp == NULL)
72                          return (ENXIO);
73                 return (aphysio(xxstrategy, anocancel, dev, B_WRITE, \
74                 xxminphys, aio));
75         }
76
77

SEE ALSO

79       write(2), aiowrite(3C), aread(9E), read(9E),  strategy(9E),  write(9E),
80       anocancel(9F),  aphysio(9F), ddi_get_soft_state(9F), drv_priv(9F), get‐
81       minor(9F), minphys(9F), nodev(9F), aio_req(9S), cb_ops(9S), uio(9S)
82
83
84       Writing Device Drivers
85

BUGS

87       There is no way other than calling aphysio(9F) to accomplish  an  asyn‐
88       chronous write.
89
90
91
92SunOS 5.11                        28 Mar 1997                       awrite(9E)
Impressum