DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

mdi_read_file(D3mdi)


mdi_read_file -- read data from a regular file opened with mdi_open_file

Synopsis

   #include <sys/types.h>
   #include <sys/stream.h>
   #include <sys/stropt.h>
   #include <sys/mdi.h>
   #include <sys/ddi.h>
   

int mdi_read_file(mdi_file_t handle, void *buf, size_t nbytes, size_t offset)

Description

mdi_read_file( ) reads data from a file opened with the mdi_open_file(D3mdi) function.

Arguments


handle
The mdi_file_t handle returned by the mdi_open_file(D3mdi) function.

buf
Caller-provided buffer into which the data will be read. The buffer need not be physically contiguous nor page aligned.

nbytes
Amount of data in bytes to read into buf.

offset
Offset in bytes from the start of the file at which to start reading.

Return values


EBADF
handle was not valid.

EINVAL
nbytes + offset exceeds the file size.

EIO
There was an error while reading from the file.

Usage

For large files, this function can be called repeatedly with increasing offsets. In this case, the driver would read some part of the file, download that data to its hardware, and then call mdi_read_file( ) again with offset set to one byte past the end of the last read( ) to read the next portion of the file.

Context and synchronization

Blockable context at a time when it is safe to lower the system interrupt priority (ipl) to plbase.

Hardware applicability

All

Version applicability

mdi: 2.1

Differences between versions

This function is not supported in MDI version 2 nor in MDI on SCO OpenServer systems.

References

_load(D2mdi), mdi_open_file(D3mdi), mdi_close_file(D3mdi)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005