1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH AWRITE 9E "Mar 28, 1997"
8 .SH NAME
9 awrite \- asynchronous write to a device
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <sys/uio.h>
14 #include <sys/aio_req.h>
15 #include <sys/cred.h>
16 #include <sys/ddi.h>
17 #include <sys/sunddi.h>
18
19 \fBintprefix\fR\fBawrite\fR(\fBdev_t\fR \fIdev\fR, \fBstruct aio_req *\fR\fIaio_reqp\fR,
20 \fBcred_t *\fR\fIcred_p\fR);
21 .fi
22
23 .SH INTERFACE LEVEL
24 .sp
25 .LP
26 Solaris \fBDDI \fRspecific (Solaris DDI). This entry point is optional. Drivers
27 that do not support an \fBawrite()\fR entry point should use \fBnodev\fR(9F)
28 .SH PARAMETERS
29 .sp
30 .ne 2
31 .na
32 \fB\fIdev\fR\fR
33 .ad
34 .RS 12n
35 Device number.
36 .RE
37
38 .sp
39 .ne 2
40 .na
41 \fB\fIaio_reqp\fR\fR
42 .ad
43 .RS 12n
44 Pointer to the \fBaio_req\fR(9S) structure that describes where the data is
45 stored.
46 .RE
47
48 .sp
49 .ne 2
50 .na
51 \fB\fIcred_p\fR\fR
52 .ad
53 .RS 12n
54 Pointer to the credential structure.
55 .RE
56
57 .SH DESCRIPTION
58 .sp
59 .LP
60 The driver's \fBawrite()\fR routine is called to perform an asynchronous write.
61 \fBgetminor\fR(9F) can be used to access the minor number component of the
62 \fIdev\fR argument. \fBawrite()\fR may use the credential structure pointed to
63 by \fIcred_p\fR to check for superuser access by calling \fBdrv_priv\fR(9F).
64 The \fBawrite()\fR routine may also examine the \fBuio\fR(9S) structure
65 through the \fBaio_req\fR structure pointer, \fBaio_reqp\fR. \fBawrite()\fR
66 must call \fBaphysio\fR(9F) with the \fBaio_req\fR pointer and a pointer to the
67 driver's \fBstrategy\fR(9E) routine.
68 .sp
69 .LP
70 No fields of the \fBuio\fR(9S) structure pointed to by \fBaio_req\fR, other
71 than \fBuio_offset\fR or \fBuio_loffset\fR, may be modified for non-seekable
72 devices.
73 .SH RETURN VALUES
74 .sp
75 .LP
76 The \fBawrite()\fR routine should return \fB0\fR for success, or the
77 appropriate error number.
78 .SH CONTEXT
79 .sp
80 .LP
81 This function is called from user context only.
82 .SH EXAMPLES
83 .LP
84 \fBExample 1 \fRUsing the \fBawrite()\fR routine:
85 .sp
86 .LP
87 The following is an example of an \fBawrite()\fR routine:
88
89 .sp
90 .in +2
91 .nf
92 static int
93 xxawrite(dev_t dev, struct aio_req *aio, cred_t *cred_p)
94 {
95 int instance;
96 struct xxstate *xsp;
97
98 instance = getminor(dev);
99 xsp = ddi_get_soft_state(statep, instance);
100 /*Verify soft state structure has been allocated */
101 if (xsp == NULL)
102 return (ENXIO);
103 return (aphysio(xxstrategy, anocancel, dev, B_WRITE, \e
104 xxminphys, aio));
105 }
106 .fi
107 .in -2
108
109 .SH SEE ALSO
110 .sp
111 .LP
112 \fBwrite\fR(2), \fBaiowrite\fR(3C), \fBaread\fR(9E), \fBread\fR(9E),
113 \fBstrategy\fR(9E), \fBwrite\fR(9E), \fBanocancel\fR(9F), \fBaphysio\fR(9F),
114 \fBddi_get_soft_state\fR(9F), \fBdrv_priv\fR(9F), \fBgetminor\fR(9F),
115 \fBminphys\fR(9F), \fBnodev\fR(9F), \fBaio_req\fR(9S), \fBcb_ops\fR(9S),
116 \fBuio\fR(9S)
117 .sp
118 .LP
119 \fIWriting Device Drivers\fR
120 .SH BUGS
121 .sp
122 .LP
123 There is no way other than calling \fBaphysio\fR(9F) to accomplish an
124 asynchronous write.
|
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH AWRITE 9E "February 15, 2020"
8 .SH NAME
9 awrite \- asynchronous write to a device
10 .SH SYNOPSIS
11 .nf
12 #include <sys/uio.h>
13 #include <sys/aio_req.h>
14 #include <sys/cred.h>
15 #include <sys/ddi.h>
16 #include <sys/sunddi.h>
17
18 \fBint prefix\fR\fBawrite\fR(\fBdev_t\fR \fIdev\fR, \fBstruct aio_req *\fR\fIaio_reqp\fR,
19 \fBcred_t *\fR\fIcred_p\fR);
20 .fi
21
22 .SH INTERFACE LEVEL
23 Solaris \fBDDI \fRspecific (Solaris DDI). This entry point is optional. Drivers
24 that do not support an \fBawrite()\fR entry point should use \fBnodev\fR(9F)
25 .SH PARAMETERS
26 .ne 2
27 .na
28 \fB\fIdev\fR\fR
29 .ad
30 .RS 12n
31 Device number.
32 .RE
33
34 .sp
35 .ne 2
36 .na
37 \fB\fIaio_reqp\fR\fR
38 .ad
39 .RS 12n
40 Pointer to the \fBaio_req\fR(9S) structure that describes where the data is
41 stored.
42 .RE
43
44 .sp
45 .ne 2
46 .na
47 \fB\fIcred_p\fR\fR
48 .ad
49 .RS 12n
50 Pointer to the credential structure.
51 .RE
52
53 .SH DESCRIPTION
54 The driver's \fBawrite()\fR routine is called to perform an asynchronous write.
55 \fBgetminor\fR(9F) can be used to access the minor number component of the
56 \fIdev\fR argument. \fBawrite()\fR may use the credential structure pointed to
57 by \fIcred_p\fR to check for superuser access by calling \fBdrv_priv\fR(9F).
58 The \fBawrite()\fR routine may also examine the \fBuio\fR(9S) structure
59 through the \fBaio_req\fR structure pointer, \fBaio_reqp\fR. \fBawrite()\fR
60 must call \fBaphysio\fR(9F) with the \fBaio_req\fR pointer and a pointer to the
61 driver's \fBstrategy\fR(9E) routine.
62 .sp
63 .LP
64 No fields of the \fBuio\fR(9S) structure pointed to by \fBaio_req\fR, other
65 than \fBuio_offset\fR or \fBuio_loffset\fR, may be modified for non-seekable
66 devices.
67 .SH RETURN VALUES
68 The \fBawrite()\fR routine should return \fB0\fR for success, or the
69 appropriate error number.
70 .SH CONTEXT
71 This function is called from user context only.
72 .SH EXAMPLES
73 \fBExample 1 \fRUsing the \fBawrite()\fR routine:
74 .sp
75 .LP
76 The following is an example of an \fBawrite()\fR routine:
77
78 .sp
79 .in +2
80 .nf
81 static int
82 xxawrite(dev_t dev, struct aio_req *aio, cred_t *cred_p)
83 {
84 int instance;
85 struct xxstate *xsp;
86
87 instance = getminor(dev);
88 xsp = ddi_get_soft_state(statep, instance);
89 /*Verify soft state structure has been allocated */
90 if (xsp == NULL)
91 return (ENXIO);
92 return (aphysio(xxstrategy, anocancel, dev, B_WRITE, \e
93 xxminphys, aio));
94 }
95 .fi
96 .in -2
97
98 .SH SEE ALSO
99 \fBwrite\fR(2), \fBaiowrite\fR(3C), \fBaread\fR(9E), \fBread\fR(9E),
100 \fBstrategy\fR(9E), \fBwrite\fR(9E), \fBanocancel\fR(9F), \fBaphysio\fR(9F),
101 \fBddi_get_soft_state\fR(9F), \fBdrv_priv\fR(9F), \fBgetminor\fR(9F),
102 \fBminphys\fR(9F), \fBnodev\fR(9F), \fBaio_req\fR(9S), \fBcb_ops\fR(9S),
103 \fBuio\fR(9S)
104 .sp
105 .LP
106 \fIWriting Device Drivers\fR
107 .SH BUGS
108 There is no way other than calling \fBaphysio\fR(9F) to accomplish an
109 asynchronous write.
|