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