|
The Pedigree Project 0.1
|
#include <FatFile.h>
Inheritance diagram for FatFile:
Collaboration diagram for FatFile:Classes | |
| struct | State |
Public Member Functions | |
| void | truncate () override |
| size_t | getSize () override |
| void | setInode (uintptr_t inode) override |
| uint64_t | maximumFileSize () const override |
| uintptr_t | futexIdentity () override |
| void | fileAttributeChanged () override |
| bool | syncPages (const uint64_t *offsets, size_t count) override |
| FatFile (String name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime, Time::Timestamp creationTime, uintptr_t inode, class Filesystem *pFs, size_t size, uint32_t dirClus=0, uint32_t dirOffset=0, File *pParent=0) | |
| ~FatFile () override | |
| uint32_t | getDirCluster () |
| void | setDirCluster (uint32_t custom) |
| uint32_t | getDirOffset () |
| void | setDirOffset (uint32_t custom) |
| uintptr_t | readBlock (uint64_t location) override |
| void | writeBlock (uint64_t location, uintptr_t addr) override |
| void | extend (size_t newSize) override |
| void | extend (size_t newSize, uint64_t location, uint64_t size) override |
| Attributes | getAttributes () const override |
| bool | sync () override |
| bool | sync (size_t offset, bool async) override |
| bool | pinBlock (uint64_t location) override |
| void | unpinBlock (uint64_t location) override |
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) |
| 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) |
| void | setSize (size_t sz) |
| virtual bool | isSymlink () |
| virtual bool | isDirectory () |
| 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 bool | allowMapping (bool shared, bool writeRequested, bool &mayWrite) |
| bool | acquireMappingUse (bool executable, bool sharedWrite) |
| void | releaseMappingUse (bool executable, bool sharedWrite) |
| uintptr_t | getInode () const |
| 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) |
Protected Member Functions | |
| CacheState & | cacheState () override |
| Mutex & | dataMutationLock () override |
| Mutex & | writeSerializationLock () override |
| size_t & | physicalPageLoans () override |
| bool | useFillCache () const override |
| bool | readPage (uint64_t location, uintptr_t destination) override |
| bool | prepareShrink (const ShrinkContext &context, UniquePointer< PreparedShrink > &prepared) override |
| bool | resizeFile (size_t size) override |
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 | allocateFileRange (size_t offset, size_t length) |
| bool | clearDataCache () |
| virtual bool | isBytewise () const |
| 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 bool | readPages (ReadPage *pages, size_t count) |
| virtual void | writeBlocks (uint64_t location, uintptr_t addr, size_t length) |
| 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 MUST_USE_RESULT uintptr_t | acquireCachedBlock (uint64_t location, bool retryChanged) |
| 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 |
| 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 Member Functions | |
| FatFile (const File &file) | |
| File & | operator= (const File &) |
| void | copyStateAttributes () |
| FatFile (State &state) | |
Static Private Member Functions | |
| static bool | checkedBatchCallback (const Cache::WritebackPage *, size_t, void *) |
| static bool | checkedWriteCallback (CacheConstants::CallbackCause cause, uintptr_t location, uintptr_t page, void *meta) |
Private Attributes | |
| State * | m_State |
| FatFile * | m_NextAlias = nullptr |
| bool | m_Proxy = false |
| uint32_t & | m_DirClus |
| uint32_t & | m_DirOffset |
| bool & | m_MetadataDirty |
| bool & | m_TrimPending |
| Vector< uint32_t > & | m_RetiredClusters |
Friends | |
| class | FatFilesystem |
| class | FatWritebackTestPeer |
Additional Inherited Members | |
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 |
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 |
|
private |
Copy constructors are hidden - unused!
| FatFile::FatFile | ( | String | name, |
| Time::Timestamp | accessedTime, | ||
| Time::Timestamp | modifiedTime, | ||
| Time::Timestamp | creationTime, | ||
| uintptr_t | inode, | ||
| class Filesystem * | pFs, | ||
| size_t | size, | ||
| uint32_t | dirClus = 0, |
||
| uint32_t | dirOffset = 0, |
||
| File * | pParent = 0 |
||
| ) |
Constructor, should be called only by a Filesystem.
Definition at line 26 of file FatFile.cc.
References File::setPermissionsOnly().
|
override |
Drains checked page writeback before destroying FAT metadata.
Definition at line 60 of file FatFile.cc.
|
explicitprivate |
Definition at line 49 of file FatFile.cc.
|
overrideprotectedvirtual |
Reimplemented from File.
Definition at line 65 of file FatFile.cc.
|
staticprivate |
Definition at line 163 of file FatFile.cc.
|
staticprivate |
Definition at line 150 of file FatFile.cc.
|
private |
Definition at line 227 of file FatFile.cc.
|
overrideprotectedvirtual |
Reimplemented from File.
Definition at line 68 of file FatFile.cc.
|
overridevirtual |
Internal function to extend a file to be at least the given size.
Reimplemented from File.
Definition at line 17 of file FatFile-resize.cc.
References File::getBlockSize(), Cache::lookup(), Cache::markDirty(), and Cache::release().
Referenced by extend().
Here is the caller graph for this function:
|
overridevirtual |
Does the same thing as extend() but with an optional hint indicating that the upcoming write will fill an entire block. This hint can be used to do things like avoid zeroing the block that would otherwise be written over anyway.
Reimplemented from File.
Definition at line 41 of file FatFile-resize.cc.
References extend().
|
overridevirtual |
Reimplemented from File.
Definition at line 261 of file FatFilesystem-attributes.cc.
|
overridevirtual |
Stable backing token; aliases of one backing object must share it.
Reimplemented from File.
Definition at line 80 of file FatFile.cc.
|
overridevirtual |
Reimplemented from File.
Definition at line 205 of file FatFile.cc.
|
overridevirtual |
Reimplemented from File.
Definition at line 77 of file FatFile.cc.
|
overridevirtual |
Maximum byte length supported by the backing, independent of free space.
Reimplemented from File.
Definition at line 257 of file FatFilesystem-attributes.cc.
|
overrideprotectedvirtual |
Reimplemented from File.
Definition at line 74 of file FatFile.cc.
|
overridevirtual |
Pins the given page.
If your File subclass uses a Cache for readBlock, this method should be implemented to call Cache::pin. The VFS layer calls this method when it determines it is about to give a physical page to an upper layer, and therefore will be unable to guarantee the virtual page's dirty status is a correct reflection of the page's state.
Returns true only when the page currently published for location is held until the matching unpinBlock(). The base implementation returns false so a cache-backed subclass cannot silently claim unsafe pages.
Reimplemented from File.
Definition at line 219 of file FatFile.cc.
References File::getBlockSize(), and Cache::pin().
|
overrideprotectedvirtual |
Reimplemented from File.
Definition at line 49 of file FatFile-resize.cc.
|
overridevirtual |
Retrieves an aligned block with one caller-owned lifetime reference.
Every successful call must be balanced by exactly one unpinBlock() at the same location. Cache-backed implementations must acquire a reference in addition to the cache entry's publication reference on both hit and miss paths.
Reimplemented from File.
Definition at line 93 of file FatFile.cc.
References File::getBlockSize(), Cache::insert(), Cache::lookup(), Cache::markNoLongerEditing(), and readPage().
|
overrideprotectedvirtual |
Fill a caller-owned native page, including zeroes for holes and the EOF tail.
Reimplemented from File.
Definition at line 134 of file FatFile.cc.
References File::getBlockSize().
Referenced by readBlock().
Here is the caller graph for this function:
|
overrideprotectedvirtual |
Reimplemented from File.
Definition at line 54 of file FatFile-resize.cc.
|
overridevirtual |
Reimplemented from File.
Definition at line 84 of file FatFile.cc.
|
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 168 of file FatFile.cc.
References Cache::syncAll().
Referenced by FatFilesystem::shutdown().
Here is the caller graph for this function:
|
overridevirtual |
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 178 of file FatFile.cc.
References File::getBlockSize(), Cache::sync(), and Cache::syncBatch().
|
overridevirtual |
Persists a bounded group of offsets whose producer pages remain pinned.
Reimplemented from File.
Definition at line 191 of file FatFile.cc.
References File::getBlockSize(), and Cache::syncBatch().
|
overridevirtual |
Delete all data from the file.
Reimplemented from File.
Definition at line 13 of file FatFile-resize.cc.
References File::resize().
|
overridevirtual |
Unpins the given page.
Reimplemented from File.
Definition at line 223 of file FatFile.cc.
References File::getBlockSize(), and Cache::release().
|
overrideprotectedvirtual |
Whether this file currently uses native-page fill caching.
Reimplemented from File.
Definition at line 121 of file FatFile.cc.
References EMIT_IF.
|
overridevirtual |
Internal function to write a block retrieved with readBlock back to the file. The address of the block is provided for convenience.
Reimplemented from File.
Definition at line 145 of file FatFile.cc.
References File::getBlockSize(), and Cache::markDirty().
|
overrideprotectedvirtual |
Reimplemented from File.
Definition at line 71 of file FatFile.cc.
|
friend |