xref: /xnu-11215/osfmk/man/device_write.html (revision 186b8fce)
1*e13b1fa5SApple OSS Distributions<h2>device_write</h2>
2*e13b1fa5SApple OSS Distributions<hr>
3*e13b1fa5SApple OSS Distributions<p>
4*e13b1fa5SApple OSS Distributions<strong>Function</strong> - Write a sequence of bytes to a specific device.
5*e13b1fa5SApple OSS Distributions<h3>SYNOPSIS</h3>
6*e13b1fa5SApple OSS Distributions<pre>
7*e13b1fa5SApple OSS Distributions<strong>#include&ltdevice/device.h&gt</strong>
8*e13b1fa5SApple OSS Distributions
9*e13b1fa5SApple OSS Distributions<strong>kern_return_t   device_write</strong>
10*e13b1fa5SApple OSS Distributions                <strong>(device_t</strong>                                <var>device</var>,
11*e13b1fa5SApple OSS Distributions                 <strong>mach_port_t</strong>                         <var>reply_port</var>,
12*e13b1fa5SApple OSS Distributions                 <strong>dev_mode_t</strong>                                <var>mode</var>,
13*e13b1fa5SApple OSS Distributions                 <strong>recnum_t</strong>                                <var>recnum</var>,
14*e13b1fa5SApple OSS Distributions                 <strong>io_buf_ptr_t</strong>                              <var>data</var>,
15*e13b1fa5SApple OSS Distributions                 <strong>mach_msg_type_number_t</strong>              <var>data_count</var>,
16*e13b1fa5SApple OSS Distributions                 <strong>io_buf_len_t</strong>                      <var>io_buf_len_t</var><strong>);</strong>
17*e13b1fa5SApple OSS Distributions
18*e13b1fa5SApple OSS Distributions
19*e13b1fa5SApple OSS Distributions<strong>#include&ltdevice/device_request.h&gt</strong>
20*e13b1fa5SApple OSS Distributions
21*e13b1fa5SApple OSS Distributions<strong>kern_return_t   device_write_request</strong>
22*e13b1fa5SApple OSS Distributions                <strong>(mach_port_t</strong>                             <var>device</var>,
23*e13b1fa5SApple OSS Distributions                 <strong>mach_port_t</strong>                         <var>reply_port</var>,
24*e13b1fa5SApple OSS Distributions                 <strong>dev_mode_t</strong>                                <var>mode</var>,
25*e13b1fa5SApple OSS Distributions                 <strong>recnum_t</strong>                                <var>recnum</var>,
26*e13b1fa5SApple OSS Distributions                 <strong>io_buf_ptr_t</strong>                              <var>data</var>,
27*e13b1fa5SApple OSS Distributions                 <strong>mach_msg_type_number_t</strong>              <var>data_count</var><strong>);</strong>
28*e13b1fa5SApple OSS Distributions
29*e13b1fa5SApple OSS Distributions
30*e13b1fa5SApple OSS Distributions<strong>kern_return_t   ds_device_write_reply</strong>
31*e13b1fa5SApple OSS Distributions                <strong>(mach_port_t</strong>                         <var>reply_port</var>,
32*e13b1fa5SApple OSS Distributions                 <strong>kern_return_t</strong>                      <var>return_code</var>,
33*e13b1fa5SApple OSS Distributions                 <strong>io_buf_len_t</strong>                     <var>bytes_written</var><strong>);</strong>
34*e13b1fa5SApple OSS Distributions</pre>
35*e13b1fa5SApple OSS Distributions<h3>PARAMETERS</h3>
36*e13b1fa5SApple OSS Distributions<dl>
37*e13b1fa5SApple OSS Distributions<p>
38*e13b1fa5SApple OSS Distributions<dt> <var>device</var>
39*e13b1fa5SApple OSS Distributions<dd>
40*e13b1fa5SApple OSS Distributions[in device send right]
41*e13b1fa5SApple OSS DistributionsA device port to the device to be written.
42*e13b1fa5SApple OSS Distributions<p>
43*e13b1fa5SApple OSS Distributions<dt> <var>reply_port</var>
44*e13b1fa5SApple OSS Distributions<dd>
45*e13b1fa5SApple OSS Distributions[in reply receive (to be converted to send-once) right]
46*e13b1fa5SApple OSS DistributionsThe port to
47*e13b1fa5SApple OSS Distributionswhich the reply message is to be sent.
48*e13b1fa5SApple OSS Distributions<p>
49*e13b1fa5SApple OSS Distributions<dt> <var>mode</var>
50*e13b1fa5SApple OSS Distributions<dd>
51*e13b1fa5SApple OSS Distributions[in scalar]
52*e13b1fa5SApple OSS DistributionsI/O mode value.  Meaningful options are:
53*e13b1fa5SApple OSS Distributions<dl>
54*e13b1fa5SApple OSS Distributions<p>
55*e13b1fa5SApple OSS Distributions<dt> <strong>D_NOWAIT</strong>
56*e13b1fa5SApple OSS Distributions<dd>
57*e13b1fa5SApple OSS DistributionsDo not wait for I/O completion.
58*e13b1fa5SApple OSS Distributions</dl>
59*e13b1fa5SApple OSS Distributions<p>
60*e13b1fa5SApple OSS Distributions<dt> <var>recnum</var>
61*e13b1fa5SApple OSS Distributions<dd>
62*e13b1fa5SApple OSS Distributions[in scalar]
63*e13b1fa5SApple OSS DistributionsRecord number to be written.
64*e13b1fa5SApple OSS Distributions<p>
65*e13b1fa5SApple OSS Distributions<dt> <var>data</var>
66*e13b1fa5SApple OSS Distributions<dd>
67*e13b1fa5SApple OSS Distributions[pointer to in array of bytes]
68*e13b1fa5SApple OSS DistributionsData bytes to be written.
69*e13b1fa5SApple OSS Distributions<p>
70*e13b1fa5SApple OSS Distributions<dt> <var>data_count</var>
71*e13b1fa5SApple OSS Distributions<dd>
72*e13b1fa5SApple OSS Distributions[in scalar]
73*e13b1fa5SApple OSS DistributionsNumber of data bytes to be written.
74*e13b1fa5SApple OSS Distributions<p>
75*e13b1fa5SApple OSS Distributions<dt> <var>return_code</var>
76*e13b1fa5SApple OSS Distributions<dd>
77*e13b1fa5SApple OSS Distributions[in scalar]
78*e13b1fa5SApple OSS DistributionsThe return status code from the write.
79*e13b1fa5SApple OSS Distributions<p>
80*e13b1fa5SApple OSS Distributions<dt> <var>bytes_written</var>
81*e13b1fa5SApple OSS Distributions<dd>
82*e13b1fa5SApple OSS Distributions[out scalar, in for asynchronous form]
83*e13b1fa5SApple OSS DistributionsSize of data transfer.
84*e13b1fa5SApple OSS Distributions</dl>
85*e13b1fa5SApple OSS Distributions<h3>DESCRIPTION</h3>
86*e13b1fa5SApple OSS Distributions<p>
87*e13b1fa5SApple OSS DistributionsThe <strong>device_write</strong> function writes a sequence of bytes
88*e13b1fa5SApple OSS Distributionsto a device object.  The
89*e13b1fa5SApple OSS Distributionsmeaning of <var>recnum</var> as well as the specific operation performed is device
90*e13b1fa5SApple OSS Distributionsdependent.
91*e13b1fa5SApple OSS Distributions<h3>RETURN VALUES</h3>
92*e13b1fa5SApple OSS Distributions<p>
93*e13b1fa5SApple OSS DistributionsOnly generic errors apply.
94*e13b1fa5SApple OSS Distributions<h3>RELATED INFORMATION</h3>
95*e13b1fa5SApple OSS Distributions<p>
96*e13b1fa5SApple OSS DistributionsFunctions:
97*e13b1fa5SApple OSS Distributions<a href="device_write_inband.html"><strong>device_write_inband</strong></a>,
98*e13b1fa5SApple OSS Distributions<a href="device_reply_server.html"><strong>device_reply_server</strong></a>.
99