The Pedigree Project 0.1
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
Ext2File Class Reference

#include <Ext2File.h>

+ Inheritance diagram for Ext2File:
+ Collaboration diagram for Ext2File:

Public Member Functions

 Ext2File (const String &name, uintptr_t inode_num, Inode *inode, class Ext2Filesystem *pFs, File *pParent=0)
 
virtual ~Ext2File () override
 
bool valid () const
 
virtual FileHandleStatus subscribeInodeEvents (FileEventMask, const SharedPointer< FileEventObserver > &, FileEventSubscription &) override
 
virtual void finishInodeRetirement () override
 
virtual void preallocate (size_t expectedSize, bool zero=true) override
 
virtual void extend (size_t newSize) override
 
virtual void extend (size_t newSize, uint64_t location, uint64_t size) override
 
virtual void truncate () override
 
virtual size_t getSize () override
 
virtual uint64_t maximumFileSize () const override
 
virtual uintptr_t futexIdentity () override
 
virtual bool tryBeginMappingRelease () override
 
virtual Attributes getAttributes () const override
 
virtual bool prepareSharedMapping (size_t offset, size_t length) override
 
void fileAttributeChanged () override
 
virtual uintptr_t readBlock (uint64_t location) override
 
virtual void writeBlock (uint64_t location, uintptr_t addr) override
 
virtual bool pinBlock (uint64_t location) override
 
virtual void unpinBlock (uint64_t location) override
 
virtual bool sync () override
 
virtual bool sync (size_t offset, bool async) override
 
bool syncPages (const uint64_t *offsets, size_t count) override
 
virtual size_t getBlockSize () const override
 
virtual XattrStatus getExtendedAttribute (const StringView &, void *, size_t, size_t &) override
 
virtual XattrStatus listExtendedAttributes (void *, size_t, size_t &) override
 
virtual XattrStatus setExtendedAttribute (const StringView &, const void *, size_t, unsigned) override
 
virtual XattrStatus removeExtendedAttribute (const StringView &) 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
 
virtual void returnPhysicalPage (size_t offset)
 
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)
 
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 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)
 
Filesystem * getFilesystem () const
 
void setFilesystem (Filesystem *pFs)
 
void publishEvent (FileEventMask mask, const StringView &name=StringView(), bool targetIsDirectory=false)
 
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)
 
void markPageExternallyWritable (size_t offset)
 
size_t populateRange (size_t offset, size_t length)
 
void enableDirect ()
 
void disableDirect ()
 
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)
 
- Public Member Functions inherited from Ext2Node
 Ext2Node (uintptr_t inode_num, Inode *pInode, class Ext2Filesystem *pFs)
 
virtual ~Ext2Node ()
 
Inode * getInode ()
 
uint32_t getInodeNumber ()
 
void fileAttributeChanged (size_t size, size_t atime, size_t mtime, size_t ctime)
 
File::Attributes inodeAttributes () const
 
void updateInodeAttributes (const File::Attributes &attributes, uint32_t mask)
 
bool changeInodeOwnership (size_t uid, size_t gid, bool changeUid, bool changeGid)
 
bool wipe (bool allocationLockHeld=false)
 
void extend (size_t newSize)
 
void extend (size_t newSize, uint64_t location, uint64_t size)
 
uint64_t maximumFileSize () const
 
bool isInlineSymlink () const
 
void updateAllocatedSectorCount ()
 
XattrStatus getXattr (const StringView &, void *, size_t, size_t &)
 
XattrStatus listXattrs (void *, size_t, size_t &)
 
XattrStatus setXattr (const StringView &, const void *, size_t, unsigned)
 
XattrStatus removeXattr (const StringView &)
 
uintptr_t readBlock (uint64_t location)
 
void writeBlock (uint64_t location)
 
void trackBlock (uint32_t block, bool writeInode=true)
 
bool pinBlock (uint64_t location)
 
void unpinBlock (uint64_t location)
 
bool sync (size_t offset, bool async)
 

Protected Member Functions

virtual void publishInodeEvent (const FileEvent &) override
 
virtual CacheState & cacheState () override
 
virtual bool useFillCache () const override
 
virtual void updateAttributes (const Attributes &attributes, uint32_t mask) override
 
virtual bool changeOwnership (size_t uid, size_t gid, bool changeUid, bool changeGid) override
 
virtual bool allowResize (size_t oldSize, size_t newSize) override
 
virtual bool allowPhysicalPage () const override
 
virtual bool prepareWrite (uint64_t location, uint64_t size) override
 
bool readPage (uint64_t location, uintptr_t destination) override
 
bool readPages (ReadPage *pages, size_t count) override
 
virtual bool resizeFile (size_t size) override
 
virtual bool allocateFileRange (size_t offset, size_t length) override
 
virtual bool prepareShrink (const ShrinkContext &context, UniquePointer< PreparedShrink > &prepared) override
 
virtual Mutex & writeSerializationLock () override
 
virtual Mutex & dataMutationLock () override
 
virtual size_t & physicalPageLoans () override
 
virtual void writeBlocks (uint64_t location, uintptr_t addr, size_t length) override
 
- Protected Member Functions inherited from File
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)
 
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
 
- 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 ()
 
- Protected Member Functions inherited from Ext2Node
XattrStatus changeXattr (const StringView &, const void *, size_t, unsigned, bool remove)
 
bool resizeData (size_t size)
 
bool trimToBlocks (size_t keep, bool allocationLockHeld=false)
 
bool zeroRange (size_t start, size_t end)
 
bool collectMappingPages (uint32_t block, unsigned depth, size_t first, size_t span, Vector< MappingPage > &pages)
 
bool prepareTrim (size_t keep, TrimPlan &plan, bool allocationLockHeld=false)
 
void commitTrim (TrimPlan &plan, bool allocationLockHeld=false)
 
bool prepareDataShrink (size_t size, UniquePointer< File::PreparedShrink > &prepared)
 
bool ensureLargeEnough (size_t size, uint64_t location, uint64_t opsize, bool onlyBlocks=false, bool nozeroblocks=false)
 
bool addBlock (uint32_t blockValue, Vector< uint32_t > *pendingWrites=0)
 
void writeBlockOrQueue (uint32_t block, Vector< uint32_t > *pendingWrites)
 
bool ensureBlockLoaded (size_t nBlock)
 
bool getBlockNumber (size_t nBlock)
 
bool getBlockNumberIndirect (uint32_t inode_block, size_t nBlocks, size_t nBlock)
 
bool getBlockNumberBiindirect (uint32_t inode_block, size_t nBlocks, size_t nBlock)
 
bool getBlockNumberTriindirect (uint32_t inode_block, size_t nBlocks, size_t nBlock)
 
bool setBlockNumber (size_t blockNum, uint32_t blockValue, Vector< uint32_t > *pendingWrites=nullptr)
 
bool ensureWritableRange (size_t location, size_t length)
 
uint32_t modeToPermissions (uint32_t mode) const
 
uint32_t permissionsToMode (uint32_t permissions) const
 

Private Member Functions

 Ext2File (const Ext2File &file)
 
Ext2File & operator= (const Ext2File &)
 
QuotaStatus beginQuota (QuotaTable &loaded)
 
QuotaStatus endQuota (QuotaType type, bool requireClean)
 
QuotaStatus writeQuotaRecord (uint32_t id, const QuotaRecord &record)
 

Static Private Member Functions

static bool sharedFillCallback (CacheConstants::CallbackCause cause, uintptr_t location, uintptr_t page, void *state)
 
static bool sharedFillBatchCallback (const Cache::WritebackPage *pages, size_t count, void *state)
 
static bool transferBlocksLocked (Ext2InodeState *state, uint64_t location, uintptr_t address, size_t length, bool write)
 

Private Attributes

bool m_OwnsQuotaProtection = false
 
bool m_Initialized = false
 

Friends

class Ext2Filesystem
 

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 Member Functions inherited from Ext2Node
static bool decodeAllocation (const Inode &, uint32_t blockSize, uint32_t &blocks, bool &inlineSymlink)
 
static bool encodeAllocation (uint32_t data, uint32_t indirect, bool hasEa, uint32_t blockSize, uint32_t &sectors)
 
- 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
 
Mutex m_Lock
 
List< MonitorTarget * > m_MonitorTargets
 
- Protected Attributes inherited from Ext2Node
Ext2InodeState * m_State
 
Inode * m_pInode
 
uint32_t m_InodeNumber
 
class Ext2Filesystem * m_pExt2Fs
 
Vector< uint32_t > & m_Blocks
 
uint32_t & m_nMetadataBlocks
 
size_t & m_nSize
 

Detailed Description

A File is a file, a directory or a symlink.

Definition at line 33 of file Ext2File.h.

Constructor & Destructor Documentation

◆ Ext2File() [1/2]

Ext2File::Ext2File ( const Ext2File &  file)
private

Copy constructors are hidden - unused!

◆ Ext2File() [2/2]

Ext2File::Ext2File ( const String &  name,
uintptr_t  inode_num,
Inode *  inode,
class Ext2Filesystem *  pFs,
File *  pParent = 0 
)

◆ ~Ext2File()

Ext2File::~Ext2File ( )
overridevirtual

Destructor

Definition at line 66 of file Ext2File.cc.

References Vector< T >::count(), Cache::empty(), and Vector< T >::erase().

Member Function Documentation

◆ allocateFileRange()

bool Ext2File::allocateFileRange ( size_t  offset,
size_t  length 
)
overrideprotectedvirtual

Called with write/data locks held; must reserve and zero newly allocated storage.

Reimplemented from File.

Definition at line 8 of file Ext2File-allocation.cc.

References Vector< T >::count(), Ext2Filesystem::m_BlockSize, Ext2Filesystem::m_nGroupDescriptors, Ext2Filesystem::m_WriteLock, Vector< T >::pushBack(), and useFillCache().

◆ allowPhysicalPage()

bool Ext2File::allowPhysicalPage ( ) const
overrideprotectedvirtual

Reimplemented from File.

Definition at line 63 of file Ext2Node-quota.cc.

◆ allowResize()

bool Ext2File::allowResize ( size_t  oldSize,
size_t  newSize 
)
overrideprotectedvirtual

Reimplemented from File.

Definition at line 55 of file Ext2Node-quota.cc.

◆ beginQuota()

QuotaStatus Ext2File::beginQuota ( QuotaTable &  loaded)
private

Definition at line 9 of file Ext2File-quota.cc.

◆ cacheState()

File::CacheState & Ext2File::cacheState ( )
overrideprotectedvirtual

Reimplemented from File.

Definition at line 85 of file Ext2File.cc.

◆ changeOwnership()

bool Ext2File::changeOwnership ( size_t  uid,
size_t  gid,
bool  changeUid,
bool  changeGid 
)
overrideprotectedvirtual

Reimplemented from File.

Definition at line 45 of file Ext2Node-quota.cc.

◆ dataMutationLock()

Mutex & Ext2File::dataMutationLock ( )
overrideprotectedvirtual

Reimplemented from File.

Definition at line 181 of file Ext2File.cc.

◆ endQuota()

QuotaStatus Ext2File::endQuota ( QuotaType  type,
bool  requireClean 
)
private

Definition at line 57 of file Ext2File-quota.cc.

◆ extend() [1/2]

void Ext2File::extend ( size_t  newSize)
overridevirtual

Internal function to extend a file to be at least the given size.

Reimplemented from File.

Definition at line 217 of file Ext2File.cc.

◆ extend() [2/2]

void Ext2File::extend ( size_t  newSize,
uint64_t  location,
uint64_t  size 
)
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 227 of file Ext2File.cc.

◆ fileAttributeChanged()

void Ext2File::fileAttributeChanged ( )
overridevirtual

Updates inode attributes.

Reimplemented from File.

Definition at line 260 of file Ext2File.cc.

References Ext2Node::fileAttributeChanged().

◆ finishInodeRetirement()

void Ext2File::finishInodeRetirement ( )
overridevirtual

Reimplemented from File.

Definition at line 29 of file Ext2InodeEvents.cc.

◆ futexIdentity()

uintptr_t Ext2File::futexIdentity ( )
overridevirtual

Stable backing token; aliases of one backing object must share it.

Reimplemented from File.

Definition at line 177 of file Ext2File.cc.

◆ getAttributes()

File::Attributes Ext2File::getAttributes ( ) const
overridevirtual

Reimplemented from File.

Definition at line 98 of file Ext2File.cc.

◆ getBlockSize()

size_t Ext2File::getBlockSize ( ) const
overridevirtual

Function to retrieve the block size returned by readBlock.

Note
This must be constant throughout the life of the file.

Reimplemented from File.

Definition at line 605 of file Ext2File.cc.

References Ext2Filesystem::m_BlockSize.

Referenced by writeBlock().

+ Here is the caller graph for this function:

◆ getExtendedAttribute()

XattrStatus Ext2File::getExtendedAttribute ( const StringView &  name,
void *  buffer,
size_t  capacity,
size_t &  required 
)
overridevirtual

Kernel buffers only. Capacity zero queries size without touching output; successful mutations update ctime and publish one Attributes event.

Reimplemented from File.

Definition at line 119 of file Ext2Xattr-write.cc.

◆ getSize()

size_t Ext2File::getSize ( )
overridevirtual

Reimplemented from File.

Definition at line 169 of file Ext2File.cc.

◆ listExtendedAttributes()

XattrStatus Ext2File::listExtendedAttributes ( void *  output,
size_t  capacity,
size_t &  required 
)
overridevirtual

Reimplemented from File.

Definition at line 123 of file Ext2Xattr-write.cc.

◆ maximumFileSize()

uint64_t Ext2File::maximumFileSize ( ) const
overridevirtual

Maximum byte length supported by the backing, independent of free space.

Reimplemented from File.

Definition at line 173 of file Ext2File.cc.

◆ physicalPageLoans()

size_t & Ext2File::physicalPageLoans ( )
overrideprotectedvirtual

Reimplemented from File.

Definition at line 189 of file Ext2File.cc.

◆ pinBlock()

bool Ext2File::pinBlock ( uint64_t  location)
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 527 of file Ext2File.cc.

◆ preallocate()

void Ext2File::preallocate ( size_t  expectedSize,
bool  zero = true 
)
overridevirtual

Optionally preallocates blocks to fit the given size.

Reimplemented from File.

Definition at line 205 of file Ext2File.cc.

References Ext2Node::ensureLargeEnough().

◆ prepareSharedMapping()

bool Ext2File::prepareSharedMapping ( size_t  offset,
size_t  length 
)
overridevirtual

Prepare backing storage before a writable shared mapping is published.

Reimplemented from File.

Definition at line 106 of file Ext2File.cc.

References Filesystem::isReadOnly(), and useFillCache().

◆ prepareShrink()

bool Ext2File::prepareShrink ( const ShrinkContext &  context,
UniquePointer< PreparedShrink > &  prepared 
)
overrideprotectedvirtual

Reimplemented from File.

Definition at line 241 of file Ext2File.cc.

◆ prepareWrite()

bool Ext2File::prepareWrite ( uint64_t  location,
uint64_t  size 
)
overrideprotectedvirtual

Reimplemented from File.

Definition at line 132 of file Ext2File.cc.

◆ publishInodeEvent()

void Ext2File::publishInodeEvent ( const FileEvent &  event)
overrideprotectedvirtual

Reimplemented from File.

Definition at line 25 of file Ext2InodeEvents.cc.

◆ readBlock()

uintptr_t Ext2File::readBlock ( uint64_t  location)
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 267 of file Ext2File.cc.

◆ readPage()

bool Ext2File::readPage ( uint64_t  location,
uintptr_t  destination 
)
overrideprotectedvirtual

Fill a caller-owned native page, including zeroes for holes and the EOF tail.

Reimplemented from File.

Definition at line 272 of file Ext2File.cc.

References Vector< T >::count(), PhysicalMemoryManager::getPageSize(), and Ext2Filesystem::m_BlockSize.

◆ readPages()

bool Ext2File::readPages ( ReadPage *  pages,
size_t  count 
)
overrideprotectedvirtual

All destination accesses finish before return; complete identifies each fully initialised page even when another page in the batch failed.

Reimplemented from File.

Definition at line 294 of file Ext2File.cc.

References Vector< T >::count(), PhysicalMemoryManager::getPageSize(), Ext2Filesystem::m_BlockSize, Filesystem::m_pDisk, and Disk::readIntoBatch().

◆ removeExtendedAttribute()

XattrStatus Ext2File::removeExtendedAttribute ( const StringView &  name)
overridevirtual

Reimplemented from File.

Definition at line 133 of file Ext2Xattr-write.cc.

◆ resizeFile()

bool Ext2File::resizeFile ( size_t  size)
overrideprotectedvirtual

Reimplemented from File.

Definition at line 249 of file Ext2File.cc.

◆ setExtendedAttribute()

XattrStatus Ext2File::setExtendedAttribute ( const StringView &  name,
const void *  value,
size_t  length,
unsigned  flags 
)
overridevirtual

Reimplemented from File.

Definition at line 126 of file Ext2Xattr-write.cc.

◆ sharedFillBatchCallback()

bool Ext2File::sharedFillBatchCallback ( const Cache::WritebackPage *  pages,
size_t  count,
void *  state 
)
staticprivate

Definition at line 436 of file Ext2File.cc.

◆ sharedFillCallback()

bool Ext2File::sharedFillCallback ( CacheConstants::CallbackCause  cause,
uintptr_t  location,
uintptr_t  page,
void *  state 
)
staticprivate

Definition at line 411 of file Ext2File.cc.

◆ subscribeInodeEvents()

FileHandleStatus Ext2File::subscribeInodeEvents ( FileEventMask  mask,
const SharedPointer< FileEventObserver > &  observer,
FileEventSubscription &  subscription 
)
overridevirtual

Reimplemented from File.

Definition at line 7 of file Ext2InodeEvents.cc.

◆ sync() [1/2]

bool Ext2File::sync ( )
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 537 of file Ext2File.cc.

References File::sync(), Cache::syncAll(), and useFillCache().

◆ sync() [2/2]

bool Ext2File::sync ( size_t  offset,
bool  async 
)
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 549 of file Ext2File.cc.

References File::syncFillCache(), and useFillCache().

◆ syncPages()

bool Ext2File::syncPages ( const uint64_t *  offsets,
size_t  count 
)
overridevirtual

Persists a bounded group of offsets whose producer pages remain pinned.

Reimplemented from File.

Definition at line 561 of file Ext2File.cc.

References Vector< T >::count(), PhysicalMemoryManager::getPageSize(), Disk::getSize(), Ext2Filesystem::m_BlockSize, Filesystem::m_pDisk, Cache::syncBatch(), Disk::syncPages(), and useFillCache().

◆ transferBlocksLocked()

bool Ext2File::transferBlocksLocked ( Ext2InodeState *  state,
uint64_t  location,
uintptr_t  address,
size_t  length,
bool  write 
)
staticprivate

Definition at line 480 of file Ext2File.cc.

◆ truncate()

void Ext2File::truncate ( )
overridevirtual

Delete all data from the file.

Reimplemented from File.

Definition at line 237 of file Ext2File.cc.

References File::resize().

◆ tryBeginMappingRelease()

bool Ext2File::tryBeginMappingRelease ( )
overridevirtual

Memory-pressure compaction must never wait on a backing mutation.

Reimplemented from File.

Definition at line 193 of file Ext2File.cc.

References Semaphore::release(), and Semaphore::tryAcquire().

◆ unpinBlock()

void Ext2File::unpinBlock ( uint64_t  location)
overridevirtual

Unpins the given page.

Reimplemented from File.

Definition at line 532 of file Ext2File.cc.

◆ updateAttributes()

void Ext2File::updateAttributes ( const Attributes &  attributes,
uint32_t  mask 
)
overrideprotectedvirtual

Reimplemented from File.

Definition at line 102 of file Ext2File.cc.

◆ useFillCache()

bool Ext2File::useFillCache ( ) const
overrideprotectedvirtual

Whether this file currently uses native-page fill caching.

Reimplemented from File.

Definition at line 89 of file Ext2File.cc.

References EMIT_IF, and File::useFillCache().

Referenced by allocateFileRange(), prepareSharedMapping(), sync(), sync(), syncPages(), writeBlock(), and writeBlocks().

+ Here is the caller graph for this function:

◆ valid()

bool Ext2File::valid ( ) const
inline

Definition at line 47 of file Ext2File.h.

◆ writeBlock()

void Ext2File::writeBlock ( uint64_t  location,
uintptr_t  addr 
)
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 382 of file Ext2File.cc.

References getBlockSize(), useFillCache(), and writeBlocks().

◆ writeBlocks()

void Ext2File::writeBlocks ( uint64_t  location,
uintptr_t  addr,
size_t  length 
)
overrideprotectedvirtual

Writes a range of whole filesystem blocks back to the file.

Reimplemented from File.

Definition at line 391 of file Ext2File.cc.

References PhysicalMemoryManager::getPageSize(), Cache::markDirty(), useFillCache(), and File::writeBlocks().

Referenced by writeBlock().

+ Here is the caller graph for this function:

◆ writeQuotaRecord()

QuotaStatus Ext2File::writeQuotaRecord ( uint32_t  id,
const QuotaRecord &  record 
)
private

Definition at line 79 of file Ext2File-quota.cc.

◆ writeSerializationLock()

Mutex & Ext2File::writeSerializationLock ( )
overrideprotectedvirtual

Reimplemented from File.

Definition at line 185 of file Ext2File.cc.

Friends And Related Symbol Documentation

◆ Ext2Filesystem

friend class Ext2Filesystem
friend

Definition at line 34 of file Ext2File.h.

Member Data Documentation

◆ m_Initialized

bool Ext2File::m_Initialized = false
private

Definition at line 114 of file Ext2File.h.

◆ m_OwnsQuotaProtection

bool Ext2File::m_OwnsQuotaProtection = false
private

Definition at line 113 of file Ext2File.h.


The documentation for this class was generated from the following files: