File System Object Creation and Deletion

A number of routines implemented by a network mini-redirector are for file creation and deletion. RDBSS abstracts this process by creating several structures including the SRV_OPEN, FCB, and FOBX structure that are reference counted. Creating or opening a file system object normally requires creating SRV_OPEN, FCB, and FOBX structures. The normal procedure would be for RDBSS to call the MRxCreate routine implemented by the network mini-redirector to fill information into these structures. It is also possible to collapse an open/create file request on an existing SRV_OPEN structure using the MRxShouldTryToCollapseThisOpen and MRxCollapseOpen routines.

In the context of a network redirector, a file object refers to a file control block (FCB) structure and a file object extension (FOBX) structure. There is a one to one correspondence between file objects and FOBXs. Many file objects will refer to the same FCB structure, which represents a single file somewhere on a remote server. A client can have several different open requests (NtCreateFile requests) on the same FCB and each of these will create a new file object. RDBSS and network mini-redirectors can choose to send fewer MRxCreate requests than the NtCreateFile requests that are received, in effect sharing a server open request (SRV_OPEN) among several FOBXs.

RDBSS and a network mini-redirector do not necessarily close the SRV_OPEN structures when the user closes a file. RDBSS can try to reuse the SRV_OPEN structure and the data without any contact with the server. Some Windows applications can open, read, and close a file and then quickly reopen the same file. In these cases, reusing the SRV_OPEN structures can improve performance.

There are several routines used to close and finalize these data structures and free any memory or other resources used when they are no longer needed. These routines include MRxCleanupFobx, MRxCloseSrvOpen, MRxDeallocateForFcb, MRxDeallocateForFobx, and MRxForceClosed.

The following table lists the routines that can be implemented by a network mini-redirector for file system object creation and deletion operations.

Routine Description
MRxAreFilesAliased

RDBSS calls this routine to query the network mini-redirector if two FCB objects represent the same file. RDBSS calls this routine when processing two files that appear to be the same but have different names (an MS-DOS short name and a long name, for example).

MRxCleanupFobx

RDBSS calls this routine to request that the network mini-redirector close a file system object extension. RDBSS issues this call in response to receiving an IRP_MJ_CLEANUP on a file object.

MRxCloseSrvOpen

RDBSS calls this routine to request that the network mini-redirector close a SRV_OPEN object.

MRxCollapseOpen

RDBSS calls this routine to request that the network mini-redirector collapse an open file system request onto an existing SRV_OPEN.

MRxCreate

RDBSS calls this routine to request that the network mini-redirector create a file system object. This call is issued by RDBSS in response to receiving an IRP_MJ_CREATE.

MRxDeallocateForFcb

RDBSS calls this routine to request that the network mini-redirector deallocate an FCB. This call is in response to a request to close a file system object.

MRxDeallocateForFobx

RDBSS calls this routine to request that the network mini-redirector deallocate an FOBX. This call is in response to a request to close a file system object.

MRxExtendForCache

RDBSS calls this routine to request that a network mini-redirector extend a file when the file is being cached by cache manager.

MRxExtendForNonCache

RDBSS calls this routine to request that a network mini-redirector extend a file when the file is not being cached by cache manager.

MRxFlush

RDBSS calls this routine to request that a network mini-redirector flush a file system object. RDBSS issue this call in response to receiving an IRP_MJ_FLUSH_BUFFERS.

MRxForceClosed

RDBSS calls this routine to request that a network mini-redirector force a close. This routine is called when the condition of the SRV_OPEN is not good or the SRV_OPEN is marked as closed.

MRxIsLockRealizable

RDBSS calls this routine to request that a network mini-redirector indicate whether byte-range locks are supported on this NET_ROOT.

MRxShouldTryToCollapseThisOpen

RDBSS calls this routine to request that a network mini-redirector indicate if RDBSS should try and collapse an open request onto an existing file system object.

MRxTruncate

RDBSS calls this routine to request that a network mini-redirector truncate a file system object.

MRxZeroExtend

RDBSS calls this routine to request that a network mini-redirector extend a file system object filling the file with zeros on cleanup if the file size is greater than the valid data length of the FCB.