|
The Pedigree Project 0.1
|
#include <FatDirectory.h>
Inheritance diagram for FatDirectory:
Collaboration diagram for FatDirectory:Classes | |
| class | NamespaceEdit |
| struct | ScannedEntry |
Public Member Functions | |
| FatDirectory (String name, uintptr_t cluster, class FatFilesystem *pFs, File *pParent, FatFileInfo &info, uint32_t dirClus=0, uint32_t dirOffset=0) | |
| ~FatDirectory () override | |
| void | truncate () override |
| void | cacheDirectoryContents () override |
| virtual bool | addEntry (String filename, File *pFile, size_t type, bool publish=true) |
| virtual bool | removeEntry (const String &filename, File *pFile) |
| void | fileAttributeChanged () override |
| bool | sync () override |
| bool | sync (size_t, bool) override |
| Attributes | getAttributes () const override |
| void | setInode (uintptr_t inode) override |
| 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) |
| bool | isDetached () const |
| size_t | getNumChildren () |
| ReadStatus | enumerate (uint64_t &cookie, DirectoryEntryEmitter emitter, void *context) |
| ReadStatus | isEmpty (bool &empty) |
| virtual bool | isCachePopulated () const |
| File * | lookup (const HashedStringView &s) const |
| MUST_USE_RESULT bool | lookupRetained (const HashedStringView &s, ChildLease &child) const |
| MUST_USE_RESULT LookupStatus | lookupChild (const HashedStringView &s, ChildLease &child) const |
| MUST_USE_RESULT LookupStatus | lookupChildAt (uint64_t cookie, const HashedStringView &name, ChildLease &child) 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. The returned pointer is borrowed; atomic publication does not pin the target directory's lifetime. | |
| void | setReparsePoint (Directory *pTarget) |
| AddStatus | addEphemeralFile (File *pFile) |
| Add an ephemeral file to the directory. | |
| void | removeEphemeralFiles () |
| bool | empty () |
| void | emptyCache () |
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 |
| size_t | readCached (uint64_t location, size_t size, uintptr_t buffer, bool(*prepare)(uintptr_t, size_t)=nullptr) |
| virtual uint64_t | write (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final |
| uint64_t | append (uint64_t size, uintptr_t buffer, uint64_t &location, bool bCanBlock=true) |
| WriteGuard | lockWrites () |
| virtual physical_uintptr_t | getPhysicalPage (size_t offset) |
| virtual bool | isDirectPhysicalMapping () const |
| size_t | physicalMappingFlags () const |
| virtual void | returnPhysicalPage (size_t offset) |
| virtual bool | tryBeginMappingRelease () |
| void | endMappingRelease () |
| bool | syncAndReturnPhysicalPage (size_t offset, bool async) |
| bool | syncRange (size_t offset, size_t length) |
| virtual bool | syncPages (const uint64_t *offsets, size_t count) |
| Time::Timestamp | getCreationTime () |
| void | setCreationTime (Time::Timestamp t) |
| Time::Timestamp | getAccessedTime () |
| void | setAccessedTime (Time::Timestamp t) |
| Time::Timestamp | getModifiedTime () |
| void | setModifiedTime (Time::Timestamp t) |
| void | setTimes (Time::Timestamp accessed, Time::Timestamp modified, bool changeAccessed, bool changeModified) |
| virtual XattrStatus | getExtendedAttribute (const StringView &name, void *buffer, size_t capacity, size_t &required) |
| virtual XattrStatus | listExtendedAttributes (void *buffer, size_t capacity, size_t &required) |
| virtual XattrStatus | setExtendedAttribute (const StringView &name, const void *value, size_t length, unsigned flags) |
| virtual XattrStatus | removeExtendedAttribute (const StringView &name) |
| virtual bool | prepareSharedMapping (size_t offset, size_t length) |
| String | getName () const |
| void | getName (String &s) const |
| virtual void | getFullPath (String &result, bool bWithMount=true) |
| virtual String | getFullPath (bool bWithMount=true) |
| bool | resize (size_t size) |
| virtual size_t | getSize () |
| void | setSize (size_t sz) |
| virtual bool | isSymlink () |
| virtual bool | isBlockDevice () const |
| virtual uint64_t | deviceNumber () const |
| virtual bool | isPipe () const |
| virtual bool | isFifo () const |
| virtual bool | isSocket () const |
| virtual bool | isSeekable () const |
| bool | supportsRegularFileOperations () |
| virtual bool | isCharacterDevice () const |
| virtual bool | isConsole () const |
| virtual uint64_t | maximumFileSize () const |
| virtual bool | allowMapping (bool shared, bool writeRequested, bool &mayWrite) |
| bool | acquireMappingUse (bool executable, bool sharedWrite) |
| void | releaseMappingUse (bool executable, bool sharedWrite) |
| uintptr_t | getInode () const |
| virtual uintptr_t | futexIdentity () |
| Filesystem * | getFilesystem () const |
| void | setFilesystem (Filesystem *pFs) |
| void | publishEvent (FileEventMask mask, const StringView &name=StringView(), bool targetIsDirectory=false) |
| virtual FileHandleStatus | subscribeInodeEvents (FileEventMask mask, const SharedPointer< FileEventObserver > &observer, FileEventSubscription &subscription) |
| virtual void | finishInodeRetirement () |
| virtual void | increaseRefCount (bool bIsWriter) |
| virtual void | decreaseRefCount (bool bIsWriter) |
| virtual bool | retainVfsReference () |
| virtual void | releaseVfsReference () |
| virtual bool | isStableVfsRoot () const |
| void | setPermissions (uint32_t perms) |
| uint32_t | getPermissions () const |
| bool | setOwnership (size_t uid, size_t gid, bool changeUid, bool changeGid) |
| void | setUid (size_t uid) |
| size_t | getUid () const |
| void | setGid (size_t gid) |
| size_t | getGid () const |
| File * | getParent () const |
| void | getNamespace (ParentLease &parent, String &name) const |
| virtual int | select (bool bWriting=false, int timeout=0) |
| virtual ReadyMask | queryReady (bool reading, bool writing) |
| virtual bool | supportsReadinessNotifications () const |
| void | monitor (Thread *pThread, Event *pEvent) |
| void | cullMonitorTargets (Thread *pThread) |
| void | cullMonitorTargets (Event *pEvent) |
| virtual bool | supports (const size_t command) const |
| virtual int | command (const size_t command, void *buffer) |
| virtual size_t | getBlockSize () const |
| void | markPageExternallyWritable (size_t offset) |
| size_t | populateRange (size_t offset, size_t length) |
| void | enableDirect () |
| void | disableDirect () |
| virtual void | preallocate (size_t expectedSize, bool zero=true) |
| bool | allocateRange (size_t offset, size_t length, bool keepSize=false) |
| virtual File * | open () |
| virtual File * | openForDescriptor (RetainedFile &owner) |
Public Member Functions inherited from ReadinessSource | |
| MUST_USE_RESULT bool | subscribeReadiness (ReadyMask interest, const SharedPointer< ReadinessObserver > &observer, ReadinessSubscription &subscription) |
| virtual ReadinessGenerations | readinessGenerations () |
Public Member Functions inherited from FileEventSource | |
| MUST_USE_RESULT bool | subscribeFileEvents (FileEventMask interest, const SharedPointer< FileEventObserver > &observer, FileEventSubscription &subscription) |
Static Public Member Functions | |
| static const String & | symlinkSuffix () |
Static Public Member Functions inherited from Directory | |
| static Directory * | fromFile (File *pF) |
Private Types | |
| using | ScanEmitter = bool(*)(void *, const ScannedEntry &, uint64_t, uint64_t) |
Private Member Functions | |
| FatDirectory (const FatDirectory &file) | |
| FatDirectory & | operator= (const FatDirectory &) |
| bool | encodeEntrySet (const String &filename, const Dir &metadata, Vector< Dir > &entries) |
| LookupStatus | resolveChild (const StringView &name, File *&child) override |
| LookupStatus | resolveChildAt (uint64_t cookie, const StringView &name, File *&child) override |
| ReadStatus | readDirectory (uint64_t &cookie, DirectoryEntryEmitter emitter, void *context) override |
| ReadStatus | scanDirectory (uint64_t &cookie, ScanEmitter emitter, void *context) |
| File * | materialize (const ScannedEntry &entry) |
Private Attributes | |
| uint32_t | m_DirClus |
| uint32_t | m_DirOffset |
| bool | m_Unlinked |
| FatType | m_Type |
| uintptr_t | m_BlockSize |
| bool | m_bRootDir |
| Mutex | m_Lock |
| uint32_t | m_DirBlockSize |
Friends | |
| class | FatFilesystem |
Additional Inherited Members | |
Public Types inherited from Directory | |
| enum class | LookupStatus { Found , NotFound , IoError , Retry } |
| enum class | ReadStatus { Complete , Stopped , IoError } |
| enum class | AddStatus { Added , Exists , IoError , Detached } |
| enum class | EntryType : uint8_t { Unknown , Regular , Directory , Symlink , Fifo , Socket , CharacterDevice , BlockDevice } |
| using | DirectoryEntryEmitter = bool(*)(void *, const DirectoryEntryView &) |
Public Types inherited from File | |
| enum | AttributeMask : uint32_t { AccessTime = 1U << 0 , ModifyTime = 1U << 1 , ChangeTime = 1U << 2 , Owner = 1U << 3 , Group = 1U << 4 , Permissions = 1U << 5 } |
Static Public Attributes inherited from File | |
| static constexpr size_t | MaxReadPages = 32 |
Protected Types inherited from Directory | |
| typedef LazyEvaluate< File, DirectoryEntryMetadata, evaluateEntry, destroyEntry > | DirectoryEntry |
Protected Member Functions inherited from Directory | |
| virtual bool | cacheResolvedChildren () const |
| virtual const DirectoryEntryCache & | getCache () |
| void | markCachePopulated () |
| bool | addDirectoryEntry (const String &name, File *pTarget) |
| bool | addDirectoryEntry (const String &name, DirectoryEntryMetadata &&meta) |
| bool | reserveDirectoryEntry (const HashedStringView &name, NameReservation &reservation) |
| bool | addCachedDirectoryEntry (NameReservation &reservation, File *pTarget) |
| void | invalidateDirectoryEntry (const HashedStringView &name) |
| bool | removeDirectoryEntry (const HashedStringView &name, File *expected) |
| Mutex & | namespaceMutationLock () |
| void | markDetached () |
| void | preallocateDirectoryEntries (size_t count) |
| virtual File * | convertToFile (const DirectoryEntryMetadata &meta) |
Protected Member Functions inherited from File | |
| bool | tryAcquireFilesystemOperation (OperationBarrier::Lease &operation) const |
| virtual void | updateAttributes (const Attributes &attributes, uint32_t mask) |
| virtual bool | changeOwnership (size_t uid, size_t gid, bool changeUid, bool changeGid) |
| virtual bool | allowPhysicalPage () const |
| virtual bool | prepareWrite (uint64_t location, uint64_t size) |
| virtual bool | allowResize (size_t oldSize, size_t newSize) |
| virtual bool | prepareShrink (const ShrinkContext &context, UniquePointer< PreparedShrink > &prepared) |
| virtual bool | resizeFile (size_t size) |
| virtual bool | allocateFileRange (size_t offset, size_t length) |
| virtual Mutex & | writeSerializationLock () |
| virtual Mutex & | dataMutationLock () |
| virtual size_t & | physicalPageLoans () |
| bool | clearDataCache () |
| 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 bool | readPage (uint64_t location, uintptr_t destination) |
| virtual bool | readPages (ReadPage *pages, size_t count) |
| virtual void | writeBlock (uint64_t location, uintptr_t addr) |
| virtual void | writeBlocks (uint64_t location, uintptr_t addr, size_t length) |
| virtual void | extend (size_t newSize) |
| virtual void | extend (size_t newSize, uint64_t location, uint64_t size) |
| virtual void | publishInodeEvent (const FileEvent &event) |
| void | dataChanged () |
| void | getFilesystemLabel (HugeStaticString &s) |
| void | enableFillCacheWriteback () |
| void | shutdownFillCacheWriteback () |
| bool | syncFillCache (size_t offset, bool async, bool &present) |
| virtual bool | useFillCache () const |
| virtual MUST_USE_RESULT bool | pinBlock (uint64_t location) |
| virtual MUST_USE_RESULT uintptr_t | acquireCachedBlock (uint64_t location, bool retryChanged) |
| 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) |
| void | retainDetachedParent () |
| void | moveNamespace (const String &name, File *parent) |
| bool | snapshotNamespace (ParentLease &parent, String &name, FileEventMask interest) const |
| virtual CacheState & | cacheState () |
| void | setPhysicalMappingFlags (size_t flags) |
Protected Member Functions inherited from ReadinessSource | |
| void | notifyReadiness (ReadyMask mask) |
| void | closeReadiness (ReadyMask mask=ReadyInvalid|ReadyHangup) |
Protected Member Functions inherited from FileEventSource | |
| bool | hasFileEventObservers (FileEventMask mask) const |
| void | notifyFileEvent (const FileEvent &event) |
| void | notifyFinalFileEvent (const FileEvent &event) |
| void | beginFinalFileEvent (const FileEvent &event) |
| void | drainFileEvents () |
| void | closeFileEvents () |
Static Protected Member Functions inherited from File | |
| static bool | writeCallback (CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page, void *meta) |
| static bool | fillCacheCallback (CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page, void *meta) |
Static Protected Member Functions inherited from FileEventSource | |
| static bool | anyFileEventObservers () |
Protected Attributes inherited from File | |
| String | m_Name |
| Time::Timestamp | m_AccessedTime |
| Time::Timestamp | m_ModifiedTime |
| Time::Timestamp | m_CreationTime |
| uintptr_t | m_Inode |
| uintptr_t | m_FutexIdentity = 0 |
| class Filesystem * | m_pFilesystem |
| size_t | m_Size |
| File * | m_pParent |
| Mutex | m_MetadataLock |
| File * | m_pDetachedParent |
| bool | m_bDetachedParentHandled |
| size_t | m_nWriters |
| size_t | m_nReaders |
| size_t | m_Uid |
| size_t | m_Gid |
| uint32_t | m_Permissions |
| CacheState | m_CacheState |
| bool | m_bDirect |
| Mutex | m_WriteLock |
| Mutex | m_DataMutationLock |
| size_t | m_PhysicalPageLoans = 0 |
| size_t | m_PhysicalMappingFlags = 0 |
| Mutex | m_Lock |
| List< MonitorTarget * > | m_MonitorTargets |
A File is a file, a directory or a symlink.
Definition at line 33 of file FatDirectory.h.
|
private |
Definition at line 99 of file FatDirectory.h.
|
private |
Copy constructors are hidden - unused!
| 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 118 of file FatDirectory.cc.
References FatFilesystem::m_BlockSize, FatFilesystem::m_Type, File::setGidOnly(), setInode(), File::setPermissionsOnly(), and File::setUidOnly().
|
override |
Destructor
Definition at line 198 of file FatDirectory.cc.
|
virtual |
Adds a directory entry.
Definition at line 329 of file FatFilesystem-namespace.cc.
References Directory::addCachedDirectoryEntry(), File::getName(), Directory::isDetached(), File::isDirectory(), m_Lock, File::publishEvent(), Directory::reserveDirectoryEntry(), and String::view().
Referenced by FatFilesystem::createDirectory(), FatFilesystem::createFile(), and FatFilesystem::createSymlink().
Here is the caller graph for this function:
|
overridevirtual |
Reads directory contents into File* cache.
Reimplemented from Directory.
Definition at line 320 of file FatDirectory.cc.
|
private |
Definition at line 143 of file FatDirectory.cc.
|
overridevirtual |
Updates inode attributes.
Reimplemented from File.
Definition at line 265 of file FatFilesystem-attributes.cc.
References fileAttributeChanged().
Referenced by fileAttributeChanged().
Here is the caller graph for this function:
|
overridevirtual |
Reimplemented from File.
Definition at line 202 of file FatDirectory.cc.
|
inline |
Definition at line 69 of file FatDirectory.h.
|
inline |
Definition at line 75 of file FatDirectory.h.
|
private |
Definition at line 465 of file FatDirectory.cc.
|
overrideprivatevirtual |
Stream backing-store entries. Resident entries are merged by enumerate().
Reimplemented from Directory.
Definition at line 572 of file FatDirectory.cc.
References Directory::isDetached(), and m_Lock.
Removes a directory entry.
Definition at line 388 of file FatFilesystem-namespace.cc.
References Directory::invalidateDirectoryEntry(), and m_Lock.
Referenced by FatFilesystem::removeNode().
Here is the caller graph for this function:
|
overrideprivatevirtual |
Resolve one backing-store entry. A found File must be new and untracked.
Reimplemented from Directory.
Definition at line 494 of file FatDirectory.cc.
References Directory::isDetached(), and m_Lock.
Referenced by resolveChildAt().
Here is the caller graph for this function:
|
overrideprivatevirtual |
Resolve one backing record at a cookie returned by readDirectory(). Implementations must fall back to a full name lookup if the cookie has become stale, so this remains equivalent to resolveChild().
Reimplemented from Directory.
Definition at line 533 of file FatDirectory.cc.
References Directory::isDetached(), m_Lock, and resolveChild().
|
private |
Definition at line 322 of file FatDirectory.cc.
|
inline |
Definition at line 72 of file FatDirectory.h.
|
inline |
Definition at line 78 of file FatDirectory.h.
|
overridevirtual |
Set the internal cluster (in the case of FAT)
Reimplemented from File.
Definition at line 210 of file FatDirectory.cc.
References m_DirBlockSize, FatFilesystem::m_Superblock, and FatFilesystem::m_Type.
Referenced by FatDirectory().
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 82 of file FatDirectory.h.
|
overridevirtual |
Sync all cached pages for the file back to disk.
Returns false if any cached page cannot be synchronised. Successful pages remain written when another page fails.
Reimplemented from File.
Definition at line 286 of file FatFilesystem-attributes.cc.
Referenced by sync().
Here is the caller graph for this function:
|
inlineoverridevirtual |
Trigger a sync of an inner cache back to disk and report completion (or queue admission for an asynchronous request).
Reimplemented from File.
Definition at line 61 of file FatDirectory.h.
References sync().
|
inlineoverridevirtual |
Delete all data from the file.
Reimplemented from File.
Definition at line 48 of file FatDirectory.h.
|
friend |
Definition at line 34 of file FatDirectory.h.
|
private |
Definition at line 113 of file FatDirectory.h.
|
private |
Definition at line 114 of file FatDirectory.h.
|
private |
Number of bytes to iterate over for this directory
Definition at line 120 of file FatDirectory.h.
Referenced by setInode().
|
private |
Definition at line 108 of file FatDirectory.h.
|
private |
Definition at line 109 of file FatDirectory.h.
|
private |
Lock for add/remove/cache operations, so we don't break horribly.
Definition at line 117 of file FatDirectory.h.
Referenced by addEntry(), readDirectory(), removeEntry(), FatFilesystem::removeNode(), FatFilesystem::renameNode(), resolveChild(), and resolveChildAt().
|
private |
Definition at line 112 of file FatDirectory.h.
|
private |
Definition at line 110 of file FatDirectory.h.