FS_ReadFile

FS_ReadFile(
 PIOREQ pir
 )
 

Operations that read from a normal file are handled through FS_ReadFile. This routine handles the Win32 function: ReadFile(); and INT 21h functions: 14h, 21h, 27h, and 3Fh.

ir_rh
Supplies handle to disk volume or network resource that contains the file.
ir_fh
Supplies FSD file handle.
ir_sfn
Supplies system file number.
ir_data
Supplies a pointer to the data buffer to read into.
ir_length
Supplies number of bytes of data to read.
ir_pos
Supplies file position to begin reading at.
ir_options
Supplies processing options.
Processing Option Values:

Any combination of the following options may be specified.

 
Value Meaning
R0_NO_CACHE File data should not be cached, that is, no read-ahead or caching on the read operation.
R0_SWAPPER_CALL This read operation is issued for the swapfile by the memory manager. Any FSD that allows paging to be done through it needs to observe some special rules to make the system work smoothly. These have already been described in section 8.3.4 of this document.
R0_MM_READ_WRITE This flag is passed in to indicate a read operation to a memory-mapped file. There is one special case in which it is used to indicate that a memory mapping has been created to an existing open file. This is when a read of 0 bytes is issued, that is, ir_length contains zero. When this special case is indicated, the FSD needs to lock down all data structures associated with the open file to prevent deadlocks. This is done prior to any other user-initiated reads are done to this memory-mapped file. This has already been described in section 8.3.5 of this document. In all other cases, this flag indicates that the current read operation is for a memory-mapped file. The FSD needs to treat these operations in a special manner as described in section 8.3.5.

ir_user
Supplies user ID for this request.
ir_pid
Supplies process ID for this request.
ir_error Returns status of the operation ( 0 if no error, errorcode otherwise ).
ir_length Returns number of bytes actually read.
ir_pos Returns new file position.

This operation may take place asynchronously, and it is recommended that the implementation of this function be async when ever possible. To do this, the function may return STATUS_PENDING to allow the caller to continue processing while the operation completes. If STATUS_PENDING is returned, the IFSMgr_CompleteAsync service in the IFSMGR must be called when the operation completes. The address of the I/O request packet must be passed to identify the completed request.