]> git.saurik.com Git - apple/xnu.git/blob - osfmk/man/device_read.html
xnu-2422.1.72.tar.gz
[apple/xnu.git] / osfmk / man / device_read.html
1 <h2>device_read</h2>
2 <hr>
3 <p>
4 <strong>Function</strong> - Read a sequence of bytes from a specific device.
5 <h3>SYNOPSIS</h3>
6 <pre>
7 <strong>#include&ltdevice/device.h&gt</strong>
8
9 <strong>kern_return_t device_read</strong>
10 <strong>(device_t</strong> <var>device</var>,
11 <strong>mach_port_t</strong> <var>reply_port</var>,
12 <strong>dev_mode_t</strong> <var>mode</var>,
13 <strong>recnum_t</strong> <var>recnum</var>,
14 <strong>io_buf_len_t</strong> <var>bytes_wanted</var>,
15 <strong>io_buf_ptr_t</strong> <var>io_buf_ptr_t</var>,
16 <strong>mach_msg_type_number_t</strong> <var>mach_msg_type_number_t</var><strong>);</strong>
17
18
19 <strong>#include&ltdevice/device_request.h&gt</strong>
20
21 <strong>kern_return_t device_read_request</strong>
22 <strong>(mach_port_t</strong> <var>device</var>,
23 <strong>mach_port_t</strong> <var>reply_port</var>,
24 <strong>dev_mode_t</strong> <var>mode</var>,
25 <strong>recnum_t</strong> <var>recnum</var>,
26 <strong>io_buf_len_t</strong> <var>bytes_wanted</var><strong>);</strong>
27
28
29
30 <strong>kern_return_t ds_device_read_reply</strong>
31 <strong>(mach_port_t</strong> <var>reply_port</var>,
32 <strong>kern_return_t</strong> <var>return_code</var>,
33 <strong>io_buf_ptr_t</strong> <var>data</var>,
34 <strong>mach_msg_type_number_t</strong> <var>data_count</var><strong>);</strong>
35 </pre>
36 <h3>PARAMETERS</h3>
37 <dl>
38 <p>
39 <dt> <var>device</var>
40 <dd>
41 [in device send right]
42 A device port to the device to be read.
43 <p>
44 <dt> <var>reply_port</var>
45 <dd>
46 [in reply receive (to be converted to send-once) right]
47 The port to
48 which the reply message is to be sent.
49 <p>
50 <dt> <var>mode</var>
51 <dd>
52 [in scalar]
53 I/O mode value. Meaningful options are:
54 <dl>
55 <p>
56 <dt> <strong>D_NOWAIT</strong>
57 <dd>
58 Do not wait if data is unavailable.
59 </dl>
60 <p>
61 <dt> <var>recnum</var>
62 <dd>
63 [in scalar]
64 Record number to be read.
65 <p>
66 <dt> <var>bytes_wanted</var>
67 <dd>
68 [in scalar]
69 Size of data transfer.
70 <p>
71 <dt> <var>return_code</var>
72 <dd>
73 [in scalar]
74 The return status code from the read.
75 <p>
76 <dt> <var>data</var>
77 <dd>
78 [out pointer to dynamic array of bytes, in for asynchronous form]
79 Returned data bytes.
80 <p>
81 <dt> <var>data_count</var>
82 <dd>
83 [out scalar, in for asynchronous form]
84 Number of returned data bytes.
85 </dl>
86 <h3>DESCRIPTION</h3>
87 <p>
88 The <strong>device_read</strong> function reads a sequence of bytes
89 from a device object. The
90 meaning of <var>recnum</var> as well as the specific operation performed is device
91 dependent.
92 <h3>RETURN VALUES</h3>
93 <p>
94 Only generic errors apply.
95 <h3>RELATED INFORMATION</h3>
96 <p>
97 Functions:
98 <a href="device_read_inband.html"><strong>device_read_inband</strong></a>,
99 <a href="device_read_overwrite.html"><strong>device_read_overwrite</strong></a>,
100 <a href="device_reply_server.html"><strong>device_reply_server</strong></a>.