FS_OpenFile(
PIOREQ pir
)
All file open and create operations are handled through FS_OpenFile. This routine handles the Win32 functions: OpenFile(), and CreateFile(); and INT 21h functions: 0Fh, 16h, 3Ch, 3Dh, 5Ah, 5Bh, 6Ch and 716Ch.
If ir_ppath is NULL, it indicates that this is a special kind of open where there is no path available, only cluster and directory information is available. This special kind of open is issued by the IFS manager when it is taking over a file handle left open by a TSR before booting into Windows. For such files, the IFS manager extracts the information from DOS about the cluster number and the directory position for the open file. The FSD needs to locate the file given this information. A pointer to a structure containing this information is passed in ir_uFName. Note that this kind of open can be issued only on FAT file systems because the only native system supported by MS-DOS is the FAT file system.
Desired Access Values:
One of the following values may be specified. |
|
Value | Meaning |
---|---|
ACCESS_READONLY | Open for read-only access. |
ACCESS_WRITEONLY | Open for write-only access. |
ACCESS_READWRITE | Open for read and write access. |
ACCESS_EXECUTE | Open for execute access. |
Sharing Mode Values:
This defines the file access granted to other processes. One of the following modes may be specified. |
|
SHARE_COMPATIBILITY | Open in compatibility mode. |
SHARE_DENYREADWRITE | Open for exclusive access. |
SHARE_DENYWRITE | Open allowing read-only access. |
SHARE_DENYREAD | Open allowing write-only access. |
SHARE_DENYNONE | Open allowing other processes access. |
SHARE_FCB | Open in the special FCB mode. |
Open Action Values:
One of the following actions or a combination of actions may be specified. Specifies the action to take if the file exists or not exists. |
|
Value | Meaning |
---|---|
ACTION_CREATENEW | Create a new file. Fail if the file already exists. |
ACTION_CREATEALWAYS | Create a new file. If the file already exists open it and set its new length and attributes. |
ACTION_OPENEXISTING | Open an existing file. Fail if the file does not exist. |
ACTION_OPENALWAYS | Open an existing file. If the file does not exist, create a new file. |
ACTION_REPLACEEXISTING | Open an existing file and set its new length. Fail if the file does not exists. |
Special Options:
The following special options can also be passed in on this API. |
|
Value | Meaning |
OPEN_FLAGS_COMMIT | The file should be opened in writethrough mode, that is, all data should be written synchronously to the disk. The data can be cached, but no dirty data should remain in the cache across calls to write to the file. |
OPEN_FLAGS_NO_CACHE | Read/write operations to this file should not be cached. There should be no data kept in the cache for this file. This also means that the file system should not do read-aheads and other optimizing techniques on this file. |
OPEN_FLAGS_NO_COMPRESS | The file should not be compressed when it is created or changed. |
OPEN_FLAGS_ALIAS_HINT | This is valid only on a create operation. The caller can pass in a number from 0 to 65535 to be used as a hint by the FSD for the numeric tail if it is auto-generating names. If the FSD does not auto-generate names, this flag should be ignored. This is purely an advisory option. |
OPEN_FLAGS_REOPEN | The file is being reopened by IFS Manager when a level 3 volume lock is released (the file was temporarily closed by IFS Manager for the duration of the level 3 volume lock). |
R0_SWAPPER_CALL | This operation is on the swap file. The swap file needs special handling as has already been discussed in section 8.3.4. |
Attribute Values:
Any combination of the following attributes may be specified or returned. |
|
Value | Meaning |
---|---|
FILE_ATTRIBUTE_READONLY | Read-Only file. |
FILE_ATTRIBUTE_HIDDEN | Hidden file. |
FILE_ATTRIBUTE_SYSTEM | System file. |
FILE_ATTRIBUTE_DIRECTORY | Subdirectory.
The following attribute will only be specified by itself. It will not be combined with any of the other attributes. |
FILE_ATTRIBUTE_VOLUMELABEL | Volume label. |
Path Parsing Flags:
The following path parsing flags are passed in. |
|
FILE_FLAG_LONG_PATH | Path has a longname component. |
FILE_FLAG_KEEP_CASE | Preserve the case of the filename passed in when storing on disk. This also implies that this call should use longname semantics for its processing. |
FILE_FLAG_HAS_DOT | Filename component has a dot in its name. |
FILE_FLAG_IS_LFN | Filename component is a longname. |
SFTOpenInfo Structure: | |
Value | Meaning |
---|---|
soi_dirclus | Supplies the logical cluster number of the directory cluster for the open file. |
soi_dirind | Supplies the index of the directory entry of the open file in the directory cluster pointed at by soi_dirclus. |
Tunnelling Structure: | |
Value | Meaning |
---|---|
tuni_bfContents | Specifies flags for the tunnelling information passed in. |
Tunnelling Info Flag Values: | |
Value | Meaning |
---|---|
TUNI_CONTAINS_ALTNAME | Alternate unicode name is available in structure. |
TUNI_CONTAINS_CREATIONT | Creation time for file available. |
TUNI_CONTAINS_LASTACCESST | Last access time for file available. |
TUNI_CONTAINS_LASTWRITET | Last modification time for file available. |
Win32 FileTime Structure: | |
Value | Meaning |
---|---|
dwLowDateTime | Supplies the low double word of the time in Win32 format. |
dwHighDateTime | Supplies the low double word of the time in Win32 format. |
ir_error | Returns status of the operation ( 0 if no error, errorcode otherwise ). |
ir_fh | Returns the FSD file handle identifying the opened file. |
ir_dostime | Returns the file modification date and time (in DOS format). |
ir_hfunc | Returns a filled in function pointer structure. The structure is filled in as follows: |
Function Pointer Structure: | |
Value | Meaning |
---|---|
hf_read | Returns pointer to FS_ReadFile function. |
hf_write | Returns pointer to FS_WriteFile function. |
hf_misc | Returns a pointer to a function table structure, in the FSD, containing a list of the remaining FSD handle based file I/O entry points. |
Function Table Structure: | |
Value | Meaning |
---|---|
hm_version | IFS version number. |
hm_revision | IFS interface revision number. |
hm_size | Number of function entry points in table. |
hm_func[NUM_HNDLMISC] | Returns an array of pointers to the handle-based functions as described below: |
hm_func[HM_SEEK] | Pointer to FS_SeekFile function. |
hm_func[HM_CLOSE] | Pointer to FS_CloseFile function. |
hm_func[HM_COMMIT] | Pointer to FS_CommitFile function. |
hm_func[HM_FILELOCKS] | Pointer to FS_LockFile function. |
hm_func[HM_FILETIMES] | Pointer to FS_FileTime function. |
hm_func[HM_PIPEREQUEST] | Pointer to FS_NamedPipeUNCRequest function. |
hm_func[HM_HANDLEINFO] | Pointer to FS_NamedPipeHandleInfo function. |
hm_func[HM_ENUMHANDLE] | Pointer to FS_EnumerateHandle function. |
ir_options | Returns the action performed by the FSD. |
Return Action Values:
One of the following actions may be returned. |
|
Value | Meaning |
---|---|
ACTION_OPENED | An existing file has been opened. |
ACTION_CREATED | A new file has been created. |
ACTION_REPLACED | An existing file has been truncated. |
ir_size | Returns the file size when an existing file is opened. The size is currently placed in the SFT in the DOS data structures. |
ir_attr | Returns the file attribute (state for named pipes). |
Return Attribute Values:
Any combination of the following attributes may be returned. |
|
Value | Meaning |
---|---|
FILE_ATTRIBUTE_READONLY | Read-Only file. |
FILE_ATTRIBUTE_HIDDEN | Hidden file. |
FILE_ATTRIBUTE_SYSTEM | System file. |
FILE_ATTRIBUTE_DIRECTORY | Subdirectory. |
FILE_ATTRIBUTE_ARCHIVE | Archive file.
This attribute cannot be returned in combination with other attributes. |
FILE_ATTRIBUTE_VOLUMELABEL | Volume label. |
If an FS does not support long filenames on a volume and it gets a LFN API call on that volume, it should fail the call. Tunnelling is described separately in another section. Tunnelling is supported only on local drives. Therefore, network FSDs do not need to honor the tunnelling information.