Close Subroutine - IBM Advanced SerialRAID Adapters SA33-3285-02 User Manual

Advanced serialraid adapters
Table of Contents

Advertisement

EINVAL
Attempted to run an open subroutine for a device instance, but either a wrong
open flag was used, or the device is not yet configured.
EIO
An I/O error occurred.
ENOMEM
The SSA device does not have enough memory resources.

close Subroutine

The close subroutine deallocates resources that are local to the target device driver for
the target or initiator device. No commands are sent to the device as a result of running
the close subroutine.
Possible return values for the errno global variable include:
EINVAL
Attempted to run a close subroutine for a device instance that is not
configured or not opened.
EIO
An I/O error occurred.
EBUSY
The device is busy.
read Subroutine
Support for the read subroutine is provided only for the target-mode device. Support for
data scattering is provided through the user-mode readv or readvx subroutine, or
through the kernel-mode fp_rwuio service call. If the read subroutine is not successful,
the return value is set to -1, and the errno global variable is set to the return value from
the device driver. If the return value is something other than -1, the read operation was
successful, and the return code indicates the number of bytes that were read. The
caller should verify the number of bytes that were read. File offsets are not applicable
and are ignored for target-mode read operations.
The adapter write operations provide the boundary that determines how read requests
are controlled. If more data is received than is requested in the current read operation,
the requested data is passed to the caller, and the remaining data is retained and
returned for the next read operation for this target device. If less data is received in the
send command than is requested, the received data is passed for the read request,
and the return value indicates how many bytes were read.
If a write operation has not been completely received when a read request is made, the
request blocks and waits for data. However, if the target device is opened with the
O_NDELAY flag set, the read does not block; it returns immediately. If no data is
available for the read request, the read is not successful, and the errno global variable
is set to EAGAIN. If data is available, it is returned. The return value indicates the
number of bytes that were received, whether the write operation for this data has ended
or not.
Note: If the O_NDELAY flag is not set, the read subroutine can block for an undefined
time while it waits for data. Because, in a read operation, the data can come at
Chapter 13. Using the Programming Interface
297

Advertisement

Table of Contents
loading

Table of Contents