|
The Pedigree Project 0.1
|
#include <Directory.h>
Inheritance diagram for Directory:
Collaboration diagram for Directory:Classes | |
| class | ChildLease |
| struct | DirectoryEntryMetadata |
| struct | DirectoryEntryView |
| struct | EnumerationContext |
| struct | InFlightLookup |
| class | NameReservation |
Public Types | |
| 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 } |
Public Member Functions | |
| 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 void | cacheDirectoryContents () |
| 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) |
| virtual bool | sync () |
| bool | syncRange (size_t offset, size_t length) |
| virtual bool | sync (size_t offset, bool async) |
| 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 Attributes | getAttributes () const |
| 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) |
| virtual void | truncate () |
| 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 void | setInode (uintptr_t inode) |
| virtual uintptr_t | futexIdentity () |
| Filesystem * | getFilesystem () const |
| void | setFilesystem (Filesystem *pFs) |
| virtual void | fileAttributeChanged () |
| 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 Directory * | fromFile (File *pF) |
Protected Types | |
| typedef LazyEvaluate< File, DirectoryEntryMetadata, evaluateEntry, destroyEntry > | DirectoryEntry |
Protected Member Functions | |
| virtual LookupStatus | resolveChild (const StringView &name, File *&child) |
| virtual bool | cacheResolvedChildren () const |
| virtual LookupStatus | resolveChildAt (uint64_t cookie, const StringView &name, File *&child) |
| virtual ReadStatus | readDirectory (uint64_t &cookie, DirectoryEntryEmitter emitter, void *context) |
| 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 () |
Private Types | |
| typedef HashTable< String, DirectoryEntry *, HashedStringView > | DirectoryEntryCache |
| typedef HashTable< String, uint64_t, HashedStringView > | DirectoryEntryGenerationCache |
| typedef HashTable< String, bool, HashedStringView > | EphemeralEntryCache |
| typedef HashTable< String, InFlightLookup *, HashedStringView > | InFlightLookupCache |
Private Member Functions | |
| Directory (const Directory &file) | |
| Directory & | operator= (const Directory &) |
| virtual bool | isBytewise () const |
| bool | reserveRenameEntry (const String &name, NameReservation &reservation) |
| void | moveReservedEntry (NameReservation &sourceReservation, Directory *destination, NameReservation &destinationReservation, File *source) |
| uint64_t | nextCacheGeneration () |
| bool | removeEphemeralFileLocked (const HashedStringView &name, File *expected) |
| void | finishNameReservation (NameReservation &reservation, LookupStatus result) |
| bool | addResidentDirectoryEntry (NameReservation &reservation, File *pTarget, bool ephemeral) |
| bool | addResidentDirectoryEntry (NameReservation &reservation, DirectoryEntry *entry, bool ephemeral, File *createdTarget=nullptr) |
| void | tombstoneResidentLocked (const HashedStringView &name) |
| File * | cachedFileLocked (const HashedStringView &name) const |
| LookupStatus | lookupChildInternal (const HashedStringView &name, uint64_t cookie, bool hasCookie, ChildLease &child) const |
Static Private Member Functions | |
| static File * | evaluateEntry (const DirectoryEntryMetadata &meta) |
| static void | destroyEntry (File *file) |
| static EntryType | entryType (File *file) |
| static bool | emitBackingEntry (void *context, const DirectoryEntryView &entry) |
Private Attributes | |
| DirectoryEntryCache | m_Cache |
| DirectoryEntryCache | m_ResidentEntries |
| Vector< String > | m_ResidentOrder |
| EphemeralEntryCache | m_EphemeralEntries |
| DirectoryEntryGenerationCache | m_CacheGenerations |
| uint64_t | m_NextCacheGeneration |
| InFlightLookupCache | m_InFlightLookups |
| bool | m_bCachePopulated |
| bool | m_Detached |
| Directory * | m_ReparseTarget = nullptr |
| uintptr_t | m_ParentInode |
| Mutex | m_CacheLock |
| Mutex | m_NamespaceMutationLock |
Static Private Attributes | |
| static constexpr uint64_t | ResidentCookie = static_cast<uint64_t>(1) << 62 |
Friends | |
| class | Filesystem |
Additional Inherited Members | |
Static Public Attributes inherited from File | |
| static constexpr size_t | MaxReadPages = 32 |
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 Directory node.
Definition at line 50 of file Directory.h.
|
protected |
Definition at line 325 of file Directory.h.
|
private |
Definition at line 328 of file Directory.h.
| using Directory::DirectoryEntryEmitter = bool (*)(void*, const DirectoryEntryView&) |
Definition at line 79 of file Directory.h.
|
private |
Definition at line 329 of file Directory.h.
|
private |
Definition at line 330 of file Directory.h.
|
private |
Definition at line 342 of file Directory.h.
|
strong |
Definition at line 58 of file Directory.h.
|
strong |
Definition at line 60 of file Directory.h.
|
strong |
Definition at line 54 of file Directory.h.
|
strong |
Definition at line 56 of file Directory.h.
| Directory::Directory | ( | ) |
Constructor, creates an invalid directory.
Definition at line 101 of file Directory.cc.
|
private |
Copy constructors are hidden - unused!
| 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 | ||
| ) |
Constructor, should be called only by a Filesystem.
Definition at line 116 of file Directory.cc.
|
virtual |
Destructor - doesn't do anything.
Definition at line 136 of file Directory.cc.
References emptyCache().
|
protected |
Publish a resolved backing entry while its name remains reserved.
Definition at line 856 of file Directory.cc.
References HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::insert(), VFS::instance(), HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::lookup(), m_Cache, m_CacheGenerations, m_CacheLock, m_ResidentEntries, and VFS::trackFile().
Referenced by Ext2Directory::addEntry(), FatDirectory::addEntry(), and addEphemeralFile().
Here is the caller graph for this function:
|
protected |
Add a lazily-evaluated entry to the directory.
Definition at line 846 of file Directory.cc.
References reserveDirectoryEntry().
Add an entry to the directory.
Definition at line 835 of file Directory.cc.
References VFS::instance(), reserveDirectoryEntry(), and VFS::trackFile().
Referenced by RawFsDir::addEntry().
Here is the caller graph for this function:| Directory::AddStatus Directory::addEphemeralFile | ( | File * | pFile | ) |
Add an ephemeral file to the directory.
This is used to store files that need to be visible in the VFS but are not backed by a "real" file on disk. For example, a socket might need to be present with a filesystem path but should not be written to disk.
Definition at line 924 of file Directory.cc.
References addCachedDirectoryEntry(), File::getName(), VFS::instance(), isDetached(), reserveDirectoryEntry(), resolveChild(), VFS::trackFile(), and String::view().
|
private |
Definition at line 801 of file Directory.cc.
|
private |
Definition at line 795 of file Directory.cc.
|
private |
Definition at line 1196 of file Directory.cc.
|
virtual |
Load the directory's contents into the cache.
Reimplemented in UnixDirectory, RawFsDir, FatDirectory, and RamDir.
Definition at line 332 of file Directory.cc.
|
inlineprotectedvirtual |
Dynamic namespaces may return a fresh retained node on every lookup.
Definition at line 299 of file Directory.h.
Referenced by Filesystem::findNode(), getChild(), and lookup().
Here is the caller graph for this function:
|
protectedvirtual |
Convert given metadata into a useful File object.
Definition at line 1148 of file Directory.cc.
|
staticprivate |
Definition at line 1144 of file Directory.cc.
|
staticprivate |
Definition at line 201 of file Directory.cc.
| bool Directory::empty | ( | ) |
Empty the entire directory, deleting all files within it (non-recursively). This does NOT check that the directory is "empty" first.
Definition at line 1033 of file Directory.cc.
References enumerate(), lookup(), and lookupChildAt().
Referenced by isEmpty().
Here is the caller graph for this function:| void Directory::emptyCache | ( | ) |
Empty the entire directory cache.
Definition at line 1091 of file Directory.cc.
References HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::clear(), Vector< T >::clear(), m_bCachePopulated, m_Cache, m_CacheGenerations, m_CacheLock, m_EphemeralEntries, m_InFlightLookups, m_NamespaceMutationLock, m_ResidentEntries, and m_ResidentOrder.
Referenced by ~Directory().
Here is the caller graph for this function:
|
staticprivate |
Definition at line 1208 of file Directory.cc.
| Directory::ReadStatus Directory::enumerate | ( | uint64_t & | cookie, |
| DirectoryEntryEmitter | emitter, | ||
| void * | context | ||
| ) |
Stream directory records without constructing a File for every child. The cookie is opaque to callers and advances only when an entry is accepted by the emitter.
Definition at line 224 of file Directory.cc.
References String::compare(), Vector< T >::count(), VFS::instance(), isDetached(), m_CacheLock, m_ParentInode, m_ResidentOrder, and readDirectory().
Referenced by empty(), getChild(), getNumChildren(), and isEmpty().
Here is the caller graph for this function:
|
staticprivate |
Definition at line 1126 of file Directory.cc.
|
private |
Definition at line 670 of file Directory.cc.
Eases the pain of casting, and performs a sanity check.
Definition at line 151 of file Directory.h.
References File::isDirectory().
Referenced by UnixFilesystem::createDirectory(), FatFilesystem::createDirectory(), UnixFilesystem::createFile(), FatFilesystem::createFile(), FatFilesystem::createSymlink(), Filesystem::findNode(), Filesystem::findParent(), ProcFs::initialise(), Filesystem::removeChild(), VFS::removeDiskFilesystem(), removeEphemeralFiles(), VFS::removeEphemeralFiles(), UnixFilesystem::removeNode(), FatFilesystem::removeNode(), and VFS::unregisterFilesystem().
Here is the caller graph for this function:
|
inlineprotectedvirtual |
Provides subclasses with direct access to the directory's listing.
Definition at line 390 of file Directory.h.
| File * Directory::getChild | ( | size_t | n | ) |
Returns the n'th child of this directory, or an invalid file.
Definition at line 140 of file Directory.cc.
References cacheResolvedChildren(), enumerate(), and lookupChildAt().
| size_t Directory::getNumChildren | ( | ) |
Returns the number of children in this directory.
Definition at line 183 of file Directory.cc.
References enumerate().
| Directory * 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.
Definition at line 916 of file Directory.cc.
References m_ReparseTarget.
Referenced by Filesystem::findNode(), and Filesystem::findParent().
Here is the caller graph for this function:
|
protected |
Invalidate one positive entry after a backing namespace mutation.
Definition at line 876 of file Directory.cc.
References HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::lookup(), m_Cache, m_CacheGenerations, m_CacheLock, m_InFlightLookups, and HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::remove().
Referenced by FatDirectory::removeEntry(), and Ext2Directory::removeEntryLocked().
Here is the caller graph for this function:
|
inlineprivatevirtual |
File subclasses can define this and return true if they require read() calls to perform actual data reads, and false if readBlock() is otherwise sufficient.
Reimplemented from File.
Definition at line 317 of file Directory.h.
|
virtual |
Does this directory have cache?
Definition at line 334 of file Directory.cc.
References m_bCachePopulated, and m_CacheLock.
|
inline |
Snapshot only; namespace entry operations separately enforce admission.
Definition at line 182 of file Directory.h.
Referenced by FatDirectory::addEntry(), addEphemeralFile(), enumerate(), FatDirectory::readDirectory(), FatFilesystem::removeNode(), reserveDirectoryEntry(), reserveRenameEntry(), FatDirectory::resolveChild(), and FatDirectory::resolveChildAt().
Here is the caller graph for this function:
|
inlinevirtual |
Returns true if the File is actually a directory.
Reimplemented from File.
Definition at line 174 of file Directory.h.
| Directory::ReadStatus Directory::isEmpty | ( | bool & | empty | ) |
Determine whether this directory contains entries other than . and ...
Definition at line 318 of file Directory.cc.
References empty(), and enumerate().
Referenced by Filesystem::removeChild(), and FatFilesystem::removeNode().
Here is the caller graph for this function:| File * Directory::lookup | ( | const HashedStringView & | s | ) | const |
Look up the given filename in the directory.
Definition at line 339 of file Directory.cc.
References cacheResolvedChildren(), and lookupChild().
Referenced by empty(), reserveDirectoryEntry(), and reserveRenameEntry().
Here is the caller graph for this function:| Directory::LookupStatus Directory::lookupChild | ( | const HashedStringView & | s, |
| ChildLease & | child | ||
| ) | const |
Resolve and retain one child without populating the whole directory.
Definition at line 355 of file Directory.cc.
Referenced by ProcFs::addProcess(), Filesystem::findNode(), lookup(), lookupChildAt(), lookupRetained(), and Filesystem::removeChild().
Here is the caller graph for this function:| Directory::LookupStatus Directory::lookupChildAt | ( | uint64_t | cookie, |
| const HashedStringView & | name, | ||
| ChildLease & | child | ||
| ) | const |
Materialize a streamed record without rescanning earlier directory entries.
Definition at line 359 of file Directory.cc.
References Vector< T >::count(), File::getNamespace(), VFS::instance(), HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::lookup(), lookupChild(), m_CacheLock, m_InFlightLookups, m_ResidentEntries, m_ResidentOrder, and VFS::retainTrackedFile().
Referenced by empty(), and getChild().
Here is the caller graph for this function:
|
private |
Definition at line 424 of file Directory.cc.
| bool Directory::lookupRetained | ( | const HashedStringView & | s, |
| ChildLease & | child | ||
| ) | const |
Atomically retain the current child of an already-stable directory. A previous output lease is preserved on failure and released only after the replacement lookup has finished using this directory. Leases are thread-affine and must have strictly lexical stack lifetimes on the Thread which acquired them.
Definition at line 351 of file Directory.cc.
References lookupChild().
|
protected |
Mark the directory cache as populated now.
Definition at line 1170 of file Directory.cc.
References m_bCachePopulated, and m_CacheLock.
Referenced by UnixDirectory::cacheDirectoryContents().
Here is the caller graph for this function:
|
protected |
Definition at line 1082 of file Directory.cc.
|
private |
Definition at line 730 of file Directory.cc.
|
inlineprotected |
Serialises namespace mutations and empty-directory removal.
Definition at line 416 of file Directory.h.
Referenced by Filesystem::removeChild(), and FatFilesystem::removeNode().
Here is the caller graph for this function:
|
private |
Definition at line 1175 of file Directory.cc.
|
protected |
Preallocate space for the given number of directory entries.
Definition at line 1165 of file Directory.cc.
References m_CacheLock, m_ResidentEntries, and HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::reserve().
|
protectedvirtual |
Stream backing-store entries. Resident entries are merged by enumerate().
Reimplemented in Ext2Directory, FatDirectory, and Iso9660Directory.
Definition at line 1161 of file Directory.cc.
Referenced by enumerate().
Here is the caller graph for this function:| void Directory::remove | ( | const HashedStringView & | s | ) |
Remove the given filename in the directory.
Definition at line 597 of file Directory.cc.
References HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::lookup(), m_Cache, m_CacheGenerations, m_CacheLock, m_EphemeralEntries, m_InFlightLookups, m_NamespaceMutationLock, m_ResidentEntries, and HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::remove().
|
protected |
Remove an authoritative entry only if its identity still matches.
Definition at line 894 of file Directory.cc.
References HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::lookup(), m_CacheGenerations, m_CacheLock, m_EphemeralEntries, m_InFlightLookups, m_ResidentEntries, and HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::remove().
|
private |
Definition at line 1008 of file Directory.cc.
| void Directory::removeEphemeralFiles | ( | ) |
Remove transient names from the cached tree after namespace writers stop.
Definition at line 961 of file Directory.cc.
References HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::contains(), fromFile(), VFS::instance(), File::isDirectory(), HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::lookup(), m_Cache, m_CacheLock, m_EphemeralEntries, m_NamespaceMutationLock, m_ResidentEntries, m_ResidentOrder, Vector< T >::pushBack(), removeEphemeralFiles(), VFS::retainTrackedFile(), and VFS::untrackFile().
Referenced by removeEphemeralFiles(), and VFS::removeEphemeralFiles().
Here is the caller graph for this function:
|
protected |
Reserve an absent name against concurrent lookup and publication.
Definition at line 627 of file Directory.cc.
References Semaphore::acquire(), HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::insert(), isDetached(), lookup(), HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::lookup(), m_CacheLock, m_InFlightLookups, m_NamespaceMutationLock, and Semaphore::release().
Referenced by addDirectoryEntry(), addDirectoryEntry(), Ext2Directory::addEntry(), FatDirectory::addEntry(), and addEphemeralFile().
Here is the caller graph for this function:
|
private |
Reserve an existing or absent name while the caller owns the namespace lock.
Definition at line 698 of file Directory.cc.
References HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::insert(), isDetached(), lookup(), HashTable< K, V, SiblingK, InitialBuckets, QuadraticProbe, GrowthFactor >::lookup(), m_CacheLock, and m_InFlightLookups.
|
protectedvirtual |
Resolve one backing-store entry. A found File must be new and untracked.
Reimplemented in Ext2Directory, FatDirectory, and Iso9660Directory.
Definition at line 1152 of file Directory.cc.
Referenced by addEphemeralFile(), and resolveChildAt().
Here is the caller graph for this function:
|
protectedvirtual |
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 in Ext2Directory, FatDirectory, and Iso9660Directory.
Definition at line 1157 of file Directory.cc.
References resolveChild().
| void Directory::setReparsePoint | ( | Directory * | pTarget | ) |
Set/unset the reparse point for this directory.
Definition at line 920 of file Directory.cc.
References m_ReparseTarget.
Referenced by VFS::removeDiskFilesystem(), and VFS::unregisterFilesystem().
Here is the caller graph for this function:
|
private |
Definition at line 1183 of file Directory.cc.
|
friend |
Definition at line 51 of file Directory.h.
|
private |
Whether the directory cache is populated with entries or still needs to be loaded. Directories are lazy-loaded using this.
Definition at line 367 of file Directory.h.
Referenced by emptyCache(), isCachePopulated(), and markCachePopulated().
|
private |
Directory contents cache.
Definition at line 345 of file Directory.h.
Referenced by addCachedDirectoryEntry(), emptyCache(), invalidateDirectoryEntry(), remove(), and removeEphemeralFiles().
|
private |
Publication identity for cache entries across callback unlocks.
Definition at line 357 of file Directory.h.
Referenced by addCachedDirectoryEntry(), emptyCache(), invalidateDirectoryEntry(), remove(), and removeDirectoryEntry().
|
mutableprivate |
Serialises child cache membership and evaluation.
Definition at line 379 of file Directory.h.
Referenced by addCachedDirectoryEntry(), emptyCache(), enumerate(), invalidateDirectoryEntry(), isCachePopulated(), lookupChildAt(), markCachePopulated(), preallocateDirectoryEntries(), remove(), removeDirectoryEntry(), removeEphemeralFiles(), reserveDirectoryEntry(), and reserveRenameEntry().
|
private |
Whether this directory has been unlinked from its parent namespace.
Definition at line 370 of file Directory.h.
|
private |
Names whose resident entry overlays, rather than belongs to, the filesystem.
Definition at line 354 of file Directory.h.
Referenced by emptyCache(), remove(), removeDirectoryEntry(), and removeEphemeralFiles().
|
mutableprivate |
Same-name backing lookups share one resolver and publication point.
Definition at line 361 of file Directory.h.
Referenced by emptyCache(), invalidateDirectoryEntry(), lookupChildAt(), remove(), removeDirectoryEntry(), reserveDirectoryEntry(), and reserveRenameEntry().
|
mutableprivate |
Prevents namespace publication from crossing a removal boundary.
Definition at line 382 of file Directory.h.
Referenced by emptyCache(), remove(), removeEphemeralFiles(), and reserveDirectoryEntry().
|
private |
Definition at line 358 of file Directory.h.
|
private |
Stable metadata for synthetic .. after this directory is unlinked.
Definition at line 376 of file Directory.h.
Referenced by enumerate().
|
private |
Reparse target.
Definition at line 373 of file Directory.h.
Referenced by getReparsePoint(), and setReparsePoint().
|
private |
Authoritative in-memory names, including synthetic and ephemeral files.
Definition at line 348 of file Directory.h.
Referenced by addCachedDirectoryEntry(), emptyCache(), lookupChildAt(), preallocateDirectoryEntries(), remove(), removeDirectoryEntry(), and removeEphemeralFiles().
Stable resident enumeration slots. Removed entries leave tombstones.
Definition at line 351 of file Directory.h.
Referenced by emptyCache(), enumerate(), lookupChildAt(), and removeEphemeralFiles().
|
staticconstexprprivate |
Definition at line 434 of file Directory.h.