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