FS_WriteFile

FS_WriteFile(
 PIOREQ pir
 )
 

Operations that write to a normal file are handled through FS_WriteFile. This routine handles the Win32 function: WriteFile(); and INT 21h functions: 15h, 22h, 28h, and 40h.

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 write.
ir_length
Supplies number of bytes of data to write.
ir_pos
Supplies file position to begin writing.
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 be written directly to the disk without going through the cache.
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 write operation to 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 written.
ir_pos Returns the new file position.

A write of 0 bytes to the file, (ir_length = 0), is used to set the end of file position. The FSD should truncate or extend the file to the passed 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 Complete_Async() 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.