The Pedigree Project
0.1
|
#include <FatDirectory.h>
Public Member Functions | |
FatDirectory (String name, uintptr_t cluster, class FatFilesystem *pFs, File *pParent, FatFileInfo &info, uint32_t dirClus=0, uint32_t dirOffset=0) | |
virtual | ~FatDirectory () |
void | truncate () |
virtual void | cacheDirectoryContents () |
virtual bool | addEntry (String filename, File *pFile, size_t type) |
virtual bool | removeEntry (File *pFile) |
void | fileAttributeChanged () |
virtual void | setInode (uintptr_t inode) |
uint32_t | getDirCluster () |
void | setDirCluster (uint32_t custom) |
uint32_t | getDirOffset () |
void | setDirOffset (uint32_t custom) |
Public Member Functions inherited from Directory | |
Directory () | |
Directory (const String &name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime, Time::Timestamp creationTime, uintptr_t inode, class Filesystem *pFs, size_t size, File *pParent) | |
virtual | ~Directory () |
virtual bool | isDirectory () |
File * | getChild (size_t n) |
size_t | getNumChildren () |
virtual bool | isCachePopulated () const |
File * | lookup (const HashedStringView &s) const |
void | remove (const HashedStringView &s) |
Directory * | getReparsePoint () const |
Get the reparse point attached to this directory. Reparse points allow locations on the filesystem to redirect lookups to a separate directory. While the reparse point is active, the target directory is used for lookups instead of this one. | |
void | setReparsePoint (Directory *pTarget) |
bool | addEphemeralFile (File *pFile) |
Add an ephemeral file to the directory. More... | |
bool | empty () |
Public Member Functions inherited from File | |
File () | |
File (const String &name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime, Time::Timestamp creationTime, uintptr_t inode, class Filesystem *pFs, size_t size, File *pParent) | |
virtual | ~File () |
virtual uint64_t | read (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final |
virtual uint64_t | write (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final |
virtual physical_uintptr_t | getPhysicalPage (size_t offset) |
virtual void | returnPhysicalPage (size_t offset) |
virtual void | sync () |
virtual void | sync (size_t offset, bool async) |
Time::Timestamp | getCreationTime () |
void | setCreationTime (Time::Timestamp t) |
Time::Timestamp | getAccessedTime () |
void | setAccessedTime (Time::Timestamp t) |
Time::Timestamp | getModifiedTime () |
void | setModifiedTime (Time::Timestamp t) |
String | getName () const |
void | getName (String &s) const |
virtual String | getFullPath (bool bWithLabel=true) |
size_t | getSize () |
void | setSize (size_t sz) |
virtual bool | isSymlink () |
virtual bool | isPipe () const |
virtual bool | isFifo () const |
virtual bool | isSocket () const |
uintptr_t | getInode () const |
Filesystem * | getFilesystem () const |
void | setFilesystem (Filesystem *pFs) |
virtual void | increaseRefCount (bool bIsWriter) |
virtual void | decreaseRefCount (bool bIsWriter) |
void | setPermissions (uint32_t perms) |
uint32_t | getPermissions () const |
void | setUid (size_t uid) |
size_t | getUid () const |
void | setGid (size_t gid) |
size_t | getGid () const |
File * | getParent () const |
virtual int | select (bool bWriting=false, int timeout=0) |
void | monitor (Thread *pThread, Event *pEvent) |
void | cullMonitorTargets (Thread *pThread) |
virtual bool | supports (const size_t command) const |
virtual int | command (const size_t command, void *buffer) |
virtual size_t | getBlockSize () const |
void | enableDirect () |
void | disableDirect () |
virtual void | preallocate (size_t expectedSize, bool zero=true) |
virtual File * | open () |
Static Public Member Functions | |
static const String & | symlinkSuffix () |
Static Public Member Functions inherited from Directory | |
static Directory * | fromFile (File *pF) |
Private Member Functions | |
FatDirectory (const FatDirectory &file) | |
FatDirectory & | operator= (const FatDirectory &) |
Private Attributes | |
uint32_t | m_DirClus |
uint32_t | m_DirOffset |
FatType | m_Type |
uintptr_t | m_BlockSize |
bool | m_bRootDir |
Mutex | m_Lock |
uint32_t | m_DirBlockSize |
Additional Inherited Members | |
Protected Types inherited from Directory | |
typedef LazyEvaluate< File, DirectoryEntryMetadata, evaluateEntry, destroyEntry > | DirectoryEntry |
Protected Member Functions inherited from Directory | |
virtual const DirectoryEntryCache & | getCache () |
void | markCachePopulated () |
void | addDirectoryEntry (const String &name, File *pTarget) |
void | addDirectoryEntry (const String &name, DirectoryEntryMetadata &&meta) |
void | preallocateDirectoryEntries (size_t count) |
virtual File * | convertToFile (const DirectoryEntryMetadata &meta) |
Protected Member Functions inherited from File | |
virtual uint64_t | readBytewise (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) |
virtual uint64_t | writeBytewise (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) |
virtual uintptr_t | readBlock (uint64_t location) |
virtual void | writeBlock (uint64_t location, uintptr_t addr) |
virtual void | extend (size_t newSize) |
virtual void | extend (size_t newSize, uint64_t location, uint64_t size) |
void | dataChanged () |
void | getFilesystemLabel (HugeStaticString &s) |
virtual void | pinBlock (uint64_t location) |
virtual void | unpinBlock (uint64_t location) |
void | evict (uint64_t location) |
void | setPermissionsOnly (uint32_t perms) |
void | setUidOnly (size_t uid) |
void | setGidOnly (size_t gid) |
Static Protected Member Functions inherited from File | |
static void | writeCallback (CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page, void *meta) |
Protected Attributes inherited from File | |
String | m_Name |
Time::Timestamp | m_AccessedTime |
Time::Timestamp | m_ModifiedTime |
Time::Timestamp | m_CreationTime |
uintptr_t | m_Inode |
class Filesystem * | m_pFilesystem |
size_t | m_Size |
File * | m_pParent |
size_t | m_nWriters |
size_t | m_nReaders |
size_t | m_Uid |
size_t | m_Gid |
uint32_t | m_Permissions |
HashTable< DataCacheKey, uintptr_t > | m_DataCache |
bool | m_bDirect |
Cache | m_FillCache |
Mutex | m_Lock |
List< MonitorTarget * > | m_MonitorTargets |
A File is a file, a directory or a symlink.
Definition at line 32 of file FatDirectory.h.
|
private |
Copy constructors are hidden - unused!
Referenced by cacheDirectoryContents().
FatDirectory::FatDirectory | ( | String | name, |
uintptr_t | cluster, | ||
class FatFilesystem * | pFs, | ||
File * | pParent, | ||
FatFileInfo & | info, | ||
uint32_t | dirClus = 0 , |
||
uint32_t | dirOffset = 0 |
||
) |
Constructor, should be called only by a Filesystem.
Definition at line 35 of file FatDirectory.cc.
References FatFilesystem::m_BlockSize, FatFilesystem::m_Type, and setInode().
|
virtual |
Destructor
Definition at line 58 of file FatDirectory.cc.
Adds a directory entry.
Definition at line 81 of file FatDirectory.cc.
References Directory::addDirectoryEntry(), FatFilesystem::convertFilenameTo(), FatFilesystem::eofValue(), FatFilesystem::findFreeCluster(), FatFilesystem::getClusterEntry(), File::getName(), Directory::isCachePopulated(), File::isDirectory(), FatFilesystem::isEof(), File::isSymlink(), m_Lock, NOTICE, FatFilesystem::readCluster(), FatFilesystem::readDirectoryPortion(), FatFilesystem::setClusterEntry(), and FatFilesystem::writeDirectoryPortion().
Referenced by FatFilesystem::createFile(), FatFilesystem::createSymlink(), and truncate().
|
virtual |
Reads directory contents into File* cache.
Reimplemented from Directory.
Definition at line 386 of file FatDirectory.cc.
References Directory::addDirectoryEntry(), String::chomp(), FatFilesystem::convertFilenameFrom(), String::endswith(), FatDirectory(), FatFilesystem::getClusterEntry(), FatFilesystem::getUnixTimestamp(), FatFilesystem::isEof(), m_DirBlockSize, m_Lock, Directory::markCachePopulated(), NOTICE, FatFilesystem::readCluster(), FatFilesystem::readDirectoryPortion(), and WARNING.
Referenced by truncate().
|
virtual |
Updates inode attributes.
Reimplemented from File.
Definition at line 570 of file FatDirectory.cc.
Referenced by truncate().
|
virtual |
Removes a directory entry.
Definition at line 296 of file FatDirectory.cc.
References ERROR, FatFilesystem::getDirectoryEntry(), File::getName(), Directory::isCachePopulated(), File::isDirectory(), File::isSymlink(), m_Lock, and FatFilesystem::writeDirectoryEntry().
Referenced by FatFilesystem::remove(), and truncate().
|
virtual |
Set the internal cluster (in the case of FAT)
Reimplemented from File.
Definition at line 62 of file FatDirectory.cc.
References m_DirBlockSize, FatFilesystem::m_Superblock, and FatFilesystem::m_Type.
Referenced by FatFilesystem::createDirectory(), FatDirectory(), and truncate().
|
inlinevirtual |
Delete all data from the file.
Reimplemented from File.
Definition at line 47 of file FatDirectory.h.
References addEntry(), cacheDirectoryContents(), fileAttributeChanged(), removeEntry(), and setInode().
|
private |
Number of bytes to iterate over for this directory
Definition at line 100 of file FatDirectory.h.
Referenced by cacheDirectoryContents(), and setInode().
|
private |
Lock for add/remove/cache operations, so we don't break horribly.
Definition at line 97 of file FatDirectory.h.
Referenced by addEntry(), cacheDirectoryContents(), and removeEntry().