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