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