FS_CloseFile


FS_CloseFile(
 PIOREQ pir
 )

A currently open file is closed through FS_CloseFile. This routine handles the Win32 function: CloseHandle(); and INT 21h functions: 10h, and 3Eh.

This routine must clean up record locks belonging to the process for the file being closed.

ir_rh

Supplies handle to disk volume or network resource which contains the file.

ir_fh

Supplies FSD file handle.

ir_sfn

Supplies system file number.

ir_options

Supplies processing options.

Proccessing Option Values:

The following options may be specified:

Value

Meaning

FILE_NO_LAST_ACCESS_DATE

Do not update last access date on the close operation even if it is currently enabled for the volume. This flag is a special flag that is passed in when a volume is locked down not allowing writes, so that there are no write operations done to the disk in all cases.

FILE_CLOSE_FOR_LEVEL3_LOCK

This is a special flag informing the FSD that this close operation is being done on a level 3 lock request by user. The FSD needs to do some special processing for files that have file record locks on them when a level 3 lock is taken. For more details, refer to the volume locking specification.

FILE_CLOSE_NO_IO

This flag informs the FSD that no i/o operation should be done during this close operation. This is usually because the resource the file was opened on is no longer available. FSDs should just clean up their internal data structures and return when this flag is set.


ir_flags

Supplies close flags.

Close Flag Values:

One of the following flags will be specified.

Value

Meaning

CLOSE_HANDLE

Ordinary close, flush buffers.

CLOSE_FOR_PROCESS

Last close for process, flush buffers and free locks the process owns.

CLOSE_FINAL

Final close of file, last process that had the file open. The FSD should free any FSD allocated memory associated with this file, flush buffers and free locks.


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_pos

Returns a pointer to the list of file record locks for this open file. This pointer should be returned only if the FILE_CLOSE_FOR_LEVEL3_LOCK flag is passed in. This list is then passed in to the FSD on a subsequent open call to FS_OpenFile. A NULL value should be returned if there are no active file record locks on this file. Volume locking is described in detail in the volume locking specification.


When the level 3 lock is taken, the IFS manager issues a CLOSE_FINAL on all open handles for the corresponding volume. It also passes in the FILE_CLOSE_FOR_LEVEL3_LOCK flag in ir_options to indicate this to the FSD. In this case, the FSD should not free the record locks on the file as it would normally. Instead, it should just return a pointer to the list of active record locks for the file. This pointer is then passed in on the FS_OpenFile call when the IFS manager reopens the file for access.