NXIo_t

Holds information about a full featured read or write operation.

Service:File and Directory

Structure

  #include <nks/fsio.h>
  
  typedef struct fsio 
  {
     void           *ioAppRef;
     NXHandle_t      ioHandle;
     unsigned long   ioFlags;
     uint32_t        reserved;
     NXOffset_t      ioRemainingHint;
     NXLockToken_t   ioLockToken;
     NXIoComp_t      ioCompletion;
     unsigned long   ioTimeOut;
     NXOffset_t      ioOffset;
     int             ioVecCount;
     NXIoVec_t      *ioVector;
     NXAsyncId_t     ioAsyncID;
     int             ioStatus;
     NXOffset_t      ioProcessed;
  #define ioBytesWritten   ioProcessed
  #define ioBytesRead      ioProcessed
  } NXIo_t;
  

Fields

ioAppRef

Points to an application-maintained reference. The ioAppRef field belongs to the caller. The caller may put any value into this field (integer, address of internal data structure, etc.) and be assured of its preservation throughout the call. For example, this field might be a next pointer for use in linking many buffers of type NXIo_t or NXIoVec_t together in a list.

ioHandle

Specifies the handle or descriptor of the file, FIFO, device, etc. to which I/O is to be performed. If ioHandle indicates a FIFO or other sequential-I/O device, all values that might be in ioOffset will be ignored.

ioFlags

Specifies hints about how I/O is to be performed including NX_IO_SYNC or NX_IO_ASYNC. Not currently supported.

reserved

Reserved.

ioRemainingHint

Specifies read-ahead.

ioLockToken

Specifies a mandatory lock token from NXFileRangeLockEx.

ioCompletion

Points to a function to call once the operation is complete, but only if NX_IO_ASYNC is set in ioFlags. Not currently supported.

ioTimeOut

Specifies the time to wait for completion of the operation before cancelling. This is only valid for FIFOs.

ioOffset

Specifies the offset in the object (file, device, etc. if relevant) at which the operation is to begin.

ioVecCount

Specifies the number of NXIoVec_t records in the array pointed at by ioVector.

ioVector

Points to an array of NXIoVec_t records describing the read or write operation. This field is both an input and output field. This field must point to an array and not a linked list. Each NXIoVec_t record's ivOpRef field remains inviolate: the caller has complete control over its contents.

ioAsyncID

Specifies an implementation-assigned identity for this operation. This is an output field. Not currently supported.

ioStatus

Specifies the status of the operation. It is an output field and is filled with 0 if the operation has completed without error, -1 if the operation is still in progress, and a positive integer error code upon failure. Not currently supported.

ioProcessed

Specifies the total number of bytes processed (either read or written) upon completion. This is an output field. The type, NXOffset_t, is guaranteed to be 64-bits wide.

ioBytesRead

Specifies a macro that renames the ioProcessed field for use by callers of NXRead.

ioBytesWritten

Specifies a macro that renames the ioProcessed field for use by callers of NXWrite.

Remarks

Currently, LibC supports only synchronous reads and writes. The fields that permit asynchronous reads and writes are ignored.

For specific information on using this structure for a read or write operation, see NXReadEx or NXWriteEx.

The caller must never zero-fill the main structure as the implementation might be using reserved fields in identifying illegal or erroneous reuse.

Once the call has been made, the data structures must not be accessed until I/O has completed.