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