xref: /xnu-10002.1.13/osfmk/man/device_read.html (revision 1031c584a5e37aff177559b9f69dbd3c8c3fd30a)
1*1031c584SApple OSS Distributions<h2>device_read</h2>
2*1031c584SApple OSS Distributions<hr>
3*1031c584SApple OSS Distributions<p>
4*1031c584SApple OSS Distributions<strong>Function</strong> - Read a sequence of bytes from 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_read</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_len_t</strong>                      <var>bytes_wanted</var>,
15*1031c584SApple OSS Distributions                 <strong>io_buf_ptr_t</strong>                      <var>io_buf_ptr_t</var>,
16*1031c584SApple OSS Distributions                 <strong>mach_msg_type_number_t</strong>  <var>mach_msg_type_number_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_read_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_len_t</strong>                      <var>bytes_wanted</var><strong>);</strong>
27*1031c584SApple OSS Distributions
28*1031c584SApple OSS Distributions
29*1031c584SApple OSS Distributions
30*1031c584SApple OSS Distributions<strong>kern_return_t   ds_device_read_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_ptr_t</strong>                              <var>data</var>,
34*1031c584SApple OSS Distributions                 <strong>mach_msg_type_number_t</strong>              <var>data_count</var><strong>);</strong>
35*1031c584SApple OSS Distributions</pre>
36*1031c584SApple OSS Distributions<h3>PARAMETERS</h3>
37*1031c584SApple OSS Distributions<dl>
38*1031c584SApple OSS Distributions<p>
39*1031c584SApple OSS Distributions<dt> <var>device</var>
40*1031c584SApple OSS Distributions<dd>
41*1031c584SApple OSS Distributions[in device send right]
42*1031c584SApple OSS DistributionsA device port to the device to be read.
43*1031c584SApple OSS Distributions<p>
44*1031c584SApple OSS Distributions<dt> <var>reply_port</var>
45*1031c584SApple OSS Distributions<dd>
46*1031c584SApple OSS Distributions[in reply receive (to be converted to send-once) right]
47*1031c584SApple OSS DistributionsThe port to
48*1031c584SApple OSS Distributionswhich the reply message is to be sent.
49*1031c584SApple OSS Distributions<p>
50*1031c584SApple OSS Distributions<dt> <var>mode</var>
51*1031c584SApple OSS Distributions<dd>
52*1031c584SApple OSS Distributions[in scalar]
53*1031c584SApple OSS DistributionsI/O mode value.  Meaningful options are:
54*1031c584SApple OSS Distributions<dl>
55*1031c584SApple OSS Distributions<p>
56*1031c584SApple OSS Distributions<dt> <strong>D_NOWAIT</strong>
57*1031c584SApple OSS Distributions<dd>
58*1031c584SApple OSS DistributionsDo not wait if data is unavailable.
59*1031c584SApple OSS Distributions</dl>
60*1031c584SApple OSS Distributions<p>
61*1031c584SApple OSS Distributions<dt> <var>recnum</var>
62*1031c584SApple OSS Distributions<dd>
63*1031c584SApple OSS Distributions[in scalar]
64*1031c584SApple OSS DistributionsRecord number to be read.
65*1031c584SApple OSS Distributions<p>
66*1031c584SApple OSS Distributions<dt> <var>bytes_wanted</var>
67*1031c584SApple OSS Distributions<dd>
68*1031c584SApple OSS Distributions[in scalar]
69*1031c584SApple OSS DistributionsSize of data transfer.
70*1031c584SApple OSS Distributions<p>
71*1031c584SApple OSS Distributions<dt> <var>return_code</var>
72*1031c584SApple OSS Distributions<dd>
73*1031c584SApple OSS Distributions[in scalar]
74*1031c584SApple OSS DistributionsThe return status code from the read.
75*1031c584SApple OSS Distributions<p>
76*1031c584SApple OSS Distributions<dt> <var>data</var>
77*1031c584SApple OSS Distributions<dd>
78*1031c584SApple OSS Distributions[out pointer to dynamic array of bytes, in for asynchronous form]
79*1031c584SApple OSS DistributionsReturned data bytes.
80*1031c584SApple OSS Distributions<p>
81*1031c584SApple OSS Distributions<dt> <var>data_count</var>
82*1031c584SApple OSS Distributions<dd>
83*1031c584SApple OSS Distributions[out scalar, in for asynchronous form]
84*1031c584SApple OSS DistributionsNumber of returned data bytes.
85*1031c584SApple OSS Distributions</dl>
86*1031c584SApple OSS Distributions<h3>DESCRIPTION</h3>
87*1031c584SApple OSS Distributions<p>
88*1031c584SApple OSS DistributionsThe <strong>device_read</strong> function reads a sequence of bytes
89*1031c584SApple OSS Distributionsfrom a device object.  The
90*1031c584SApple OSS Distributionsmeaning of <var>recnum</var> as well as the specific operation performed is device
91*1031c584SApple OSS Distributionsdependent.
92*1031c584SApple OSS Distributions<h3>RETURN VALUES</h3>
93*1031c584SApple OSS Distributions<p>
94*1031c584SApple OSS DistributionsOnly generic errors apply.
95*1031c584SApple OSS Distributions<h3>RELATED INFORMATION</h3>
96*1031c584SApple OSS Distributions<p>
97*1031c584SApple OSS DistributionsFunctions:
98*1031c584SApple OSS Distributions<a href="device_read_inband.html"><strong>device_read_inband</strong></a>,
99*1031c584SApple OSS Distributions<a href="device_read_overwrite.html"><strong>device_read_overwrite</strong></a>,
100*1031c584SApple OSS Distributions<a href="device_reply_server.html"><strong>device_reply_server</strong></a>.
101