device_readreads bytes_wanted bytes from device, and stores them in a buffer allocated with
vm_allocate, which address is returned in data. The caller must deallocated it if it is no longer needed. The number of bytes actually returned is stored in data_count.
If mode is
D_NOWAIT, the operation does not block. Otherwise mode should be 0. recnum is the record number to be read, its meaning is device specific.
The function returns
D_SUCCESSif some data was successfully read,
D_WOULD_BLOCKif no data is currently available and
D_NOWAITis specified, and
D_NO_SUCH_DEVICEif device does not denote a device port.
device_read_inbandfunction works as the
device_readfunction, except that the data is returned “in-line” in the reply IPC message (see Memory).
This is the asynchronous form of the
device_read_requestperforms the read request. The meaning for the parameters is as in
device_read. Additionally, the caller has to supply a reply port to which the
ds_device_read_replymessage is sent by the kernel when the read has been performed. The return value of the read operation is stored in return_code.
As neither function receives a reply message, only message transmission errors apply. If no error occurs,
ds_device_read_reply_inbandfunctions work as the
ds_device_read_replyfunctions, except that the data is returned “in-line” in the reply IPC message (see Memory).