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