Holds the arguments for a comprehensive open request.
#include <nks/fsio.h> typedef struct { NXPathCtx_t fosPathCtx; const void *fosPathname; NXMode_t fosMode; NXOFlags_t fosOFlags; NXShareMode_t fosShareMode; size_t fosExtentSize; uint32_t reserved1; NXDelegType_t fosDelegType; NXDataStream_t fosDataStream; NXFsUpCall_t fosUpCallFunc; struct { NXMode_t actionTaken; NXDelegType_t delegType; NXFid_t fid; NXTime_t accessTime; NXTime_t modifyTime; NXTime_t creationTime; NXTime_t archiveTime; NXOffset_t length; } fosResult; uint32_t reserved2; uint32_t reserved3; } NXFileOpenSpec_t;
Specifies a file system path context. Along with the fosPathname parameter, it specifies the file to open.
Points to a null-terminated Unicode, UTF-8, or ASCII string that specifies the name of the file (relative to pathCtx) to open or create.
Specifies if the file is to be opened for reading, writing, or both. See NKS Open Modes.
Specifies various modes in which to open the file (depending on how it will be accessed or used). These specifiers are hints to NKS that allow special treatments of files (such as time of backup) or features (such as direct file access). Some of these flags are mutually exclusive (such as for backup and restore).
Indicates how a file being opened is to be shared with an already opened instance and other, subsequent instances in the same or different VM. This functionality provides a file-level locking facility. You must still use byte-range locks to ensure file consistency when the file is shared. See Shared Modes.
Provides a hint to the file system on the size of extents (sets of contiguous file system blocks) to be used when allocating new blocks to the file. This is ignored if the underlying file system implementation does not support it.
Reserved.
Specifies the type of delegation request the caller wants on the file. The type of delegation actually granted is returned after opening.
This is for use by server applications that handle multiple clients for performance improvement and cache consistency. Special privileges are required by applications to use this field.
Indicates which data stream if this is not part of the pathname proper. This structure has two fields:
If it exists, specifies a function to be called by NKS when the delegation granted is revoked.
This is for use by server applications that handle multiple clients for performance improvement and cache consistency. Special privileges are required by applications to use this field.
Returns the mode in which the file was opened. This may be a subset of the modes requested.
Returns the delegation type actually granted.
Returns the FID of the opened file.
Returns the last date and time the opened file was accessed prior to being opened.
Returns the last date and time the file was modified.
Returns the creation date and time of the file.
Returns the last date and time the file was backed up.
Returns the length of the file at open.
Reserved.
Reserved.
The fosResult structure contains the state of the create or open operation after completion.
The fosShareMode and fosMode options of an open instance of a file determine whether another open request with a specific fosShareMode and fosMode on the same file can be allowed. The fosShareMode and fosMode options specified by an open instance are used for this check only as long as that instance is still in effect. The following matrix explains this for the share modes (DENYALL, DENYWR, DENYRD, and DENTNO) and the open modes (RD, RW, and WR).
Figure 19-1 Illustrates how share modes and open modes interact.
Read and write operations that are performed on the open file are not atomic by default, which means that multiple writes to the same file can be interleaved. Atomic read and/or write operations can be requested by specifying the open flag, NX_OFLAG_ATOMIC_RW. However, this feature is available only if the underlying file system implementation supports it.
By default, read and write operations on an opened file are buffered by the file system.