Pyrogenesis
13997
|
#include <vfs.h>
Public Member Functions | |
virtual | ~IVFS () |
virtual Status | Mount (const VfsPath &mountPoint, const OsPath &path, size_t flags=0, size_t priority=0)=0 |
mount a directory into the VFS. More... | |
virtual Status | GetFileInfo (const VfsPath &pathname, CFileInfo *pfileInfo) const =0 |
Retrieve information about a file (similar to POSIX stat). More... | |
virtual Status | GetFilePriority (const VfsPath &pathname, size_t *ppriority) const =0 |
Retrieve mount priority for a file. More... | |
virtual Status | GetDirectoryEntries (const VfsPath &path, CFileInfos *fileInfos, DirectoryNames *subdirectoryNames) const =0 |
Retrieve lists of all files and subdirectories in a directory. More... | |
virtual Status | CreateFile (const VfsPath &pathname, const shared_ptr< u8 > &fileContents, size_t size)=0 |
Create a file with the given contents. More... | |
virtual Status | ReplaceFile (const VfsPath &pathname, const shared_ptr< u8 > &fileContents, size_t size)=0 |
Replace a file with the given contents. More... | |
virtual Status | LoadFile (const VfsPath &pathname, shared_ptr< u8 > &fileContents, size_t &size)=0 |
Read an entire file into memory. More... | |
virtual std::wstring | TextRepresentation () const =0 |
virtual Status | GetRealPath (const VfsPath &pathname, OsPath &realPathname)=0 |
retrieve the real (POSIX) pathname underlying a VFS file. More... | |
virtual Status | GetDirectoryRealPath (const VfsPath &pathname, OsPath &realPathname)=0 |
retrieve the real (POSIX) pathname underlying a VFS directory. More... | |
virtual Status | GetVirtualPath (const OsPath &realPathname, VfsPath &pathname)=0 |
retrieve the VFS pathname that corresponds to a real file. More... | |
virtual Status | RemoveFile (const VfsPath &pathname)=0 |
remove file from the virtual directory listing and evict its data from the cache. More... | |
virtual Status | RepopulateDirectory (const VfsPath &path)=0 |
request the directory be re-populated when it is next accessed. More... | |
virtual void | Clear ()=0 |
empty the contents of the filesystem. More... | |
|
pure virtual |
empty the contents of the filesystem.
this is typically only necessary when changing the set of mounted directories, e.g. when switching mods. NB: open files are not affected.
Implemented in VFS.
|
pure virtual |
Create a file with the given contents.
pathname | |
fileContents | |
size | [bytes] of the contents, will match that of the file. |
rationale: disallowing partial writes simplifies file cache coherency (we need only invalidate cached data when closing a newly written file).
Implemented in VFS.
|
pure virtual |
Retrieve lists of all files and subdirectories in a directory.
Rationale:
Implemented in VFS.
|
pure virtual |
Retrieve information about a file (similar to POSIX stat).
pathname | |
pfileInfo | receives information about the file. Passing NULL suppresses warnings if the file doesn't exist. |
Implemented in VFS.
|
pure virtual |
Retrieve mount priority for a file.
pathname | |
ppriority | receives priority value, if the file can be found. |
Implemented in VFS.
|
pure virtual |
retrieve the VFS pathname that corresponds to a real file.
this is useful for reacting to file change notifications.
the current implementation requires time proportional to the number of directories; this could be accelerated by only checking directories below a mount point with a matching real path.
Implemented in VFS.
|
pure virtual |
Read an entire file into memory.
pathname | |
fileContents | receives a smart pointer to the contents. CAVEAT: this will be taken from the file cache if the VFS was created with cacheSize != 0 and size < cacheSize. There is no provision for Copy-on-Write, which means that such buffers must not be modified (this is enforced via mprotect). |
size | receives the size [bytes] of the file contents. |
Implemented in VFS.
|
pure virtual |
mount a directory into the VFS.
mountPoint | (will be created if it does not already exist) |
path | real directory path |
flags | |
priority |
if files are encountered that already exist in the VFS (sub)directories, the most recent / highest priority/precedence version is preferred.
if files with archive extensions are seen, their contents are added as well.
Implemented in VFS.
remove file from the virtual directory listing and evict its data from the cache.
Implemented in VFS.
|
pure virtual |
Replace a file with the given contents.
Used to replace a file if it is already present (even if the file is not in the attached vfs directory). Calls CreateFile if the file doesn't yet exist.
Implemented in VFS.
request the directory be re-populated when it is next accessed.
useful for synchronizing with the underlying filesystem after files have been created or their metadata changed.
Implemented in VFS.
|
pure virtual |
Implemented in VFS.