The Pedigree Project  0.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FatFile Class Reference

#include <FatFile.h>

+ Inheritance diagram for FatFile:
+ Collaboration diagram for FatFile:

Public Member Functions

 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)
 
virtual ~FatFile ()
 
uint32_t getDirCluster ()
 
void setDirCluster (uint32_t custom)
 
uint32_t getDirOffset ()
 
void setDirOffset (uint32_t custom)
 
uintptr_t readBlock (uint64_t location)
 
void writeBlock (uint64_t location, uintptr_t addr)
 
virtual void extend (size_t newSize)
 
virtual void extend (size_t newSize, uint64_t location, uint64_t size)
 
virtual void sync (size_t offset, bool async)
 
virtual void pinBlock (uint64_t location)
 
virtual void unpinBlock (uint64_t location)
 
- Public Member Functions inherited from File
 File ()
 
 File (const String &name, Time::Timestamp accessedTime, Time::Timestamp modifiedTime, Time::Timestamp creationTime, uintptr_t inode, class Filesystem *pFs, size_t size, File *pParent)
 
virtual ~File ()
 
virtual uint64_t read (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
 
virtual uint64_t write (uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
 
virtual physical_uintptr_t getPhysicalPage (size_t offset)
 
virtual void returnPhysicalPage (size_t offset)
 
virtual void sync ()
 
Time::Timestamp getCreationTime ()
 
void setCreationTime (Time::Timestamp t)
 
Time::Timestamp getAccessedTime ()
 
void setAccessedTime (Time::Timestamp t)
 
Time::Timestamp getModifiedTime ()
 
void setModifiedTime (Time::Timestamp t)
 
String getName () const
 
void getName (String &s) const
 
virtual String getFullPath (bool bWithLabel=true)
 
virtual void truncate ()
 
size_t getSize ()
 
void setSize (size_t sz)
 
virtual bool isSymlink ()
 
virtual bool isDirectory ()
 
virtual bool isPipe () const
 
virtual bool isFifo () const
 
virtual bool isSocket () const
 
uintptr_t getInode () const
 
virtual void setInode (uintptr_t inode)
 
FilesystemgetFilesystem () const
 
void setFilesystem (Filesystem *pFs)
 
virtual void fileAttributeChanged ()
 
virtual void increaseRefCount (bool bIsWriter)
 
virtual void decreaseRefCount (bool bIsWriter)
 
void setPermissions (uint32_t perms)
 
uint32_t getPermissions () const
 
void setUid (size_t uid)
 
size_t getUid () const
 
void setGid (size_t gid)
 
size_t getGid () const
 
FilegetParent () const
 
virtual int select (bool bWriting=false, int timeout=0)
 
void monitor (Thread *pThread, Event *pEvent)
 
void cullMonitorTargets (Thread *pThread)
 
virtual bool supports (const size_t command) const
 
virtual int command (const size_t command, void *buffer)
 
virtual size_t getBlockSize () const
 
void enableDirect ()
 
void disableDirect ()
 
virtual void preallocate (size_t expectedSize, bool zero=true)
 
virtual Fileopen ()
 

Private Member Functions

 FatFile (const File &file)
 
Fileoperator= (const File &)
 

Private Attributes

uint32_t m_DirClus
 
uint32_t m_DirOffset
 
Cache m_FileBlockCache
 

Additional Inherited Members

- Protected Member Functions inherited from File
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 evict (uint64_t location)
 
void setPermissionsOnly (uint32_t perms)
 
void setUidOnly (size_t uid)
 
void setGidOnly (size_t gid)
 
- Static Protected Member Functions inherited from File
static void writeCallback (CacheConstants::CallbackCause cause, uintptr_t loc, uintptr_t page, void *meta)
 
- Protected Attributes inherited from File
String m_Name
 
Time::Timestamp m_AccessedTime
 
Time::Timestamp m_ModifiedTime
 
Time::Timestamp m_CreationTime
 
uintptr_t m_Inode
 
class Filesystemm_pFilesystem
 
size_t m_Size
 
Filem_pParent
 
size_t m_nWriters
 
size_t m_nReaders
 
size_t m_Uid
 
size_t m_Gid
 
uint32_t m_Permissions
 
HashTable< DataCacheKey, uintptr_t > m_DataCache
 
bool m_bDirect
 
Cache m_FillCache
 
Mutex m_Lock
 
List< MonitorTarget * > m_MonitorTargets
 

Detailed Description

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

Definition at line 30 of file FatFile.h.

Constructor & Destructor Documentation

FatFile::FatFile ( const File file)
private

Copy constructors are hidden - unused!

Referenced by FatFilesystem::createFile().

+ Here is the caller graph for this function:

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 23 of file FatFile.cc.

References Cache::setCallback(), and File::writeCallback().

FatFile::~FatFile ( )
virtual

Destructor - doesn't do anything.

Definition at line 40 of file FatFile.cc.

Member Function Documentation

void FatFile::extend ( size_t  newSize)
virtual

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

Reimplemented from File.

Definition at line 82 of file FatFile.cc.

Referenced by extend().

+ Here is the caller graph for this function:

void FatFile::extend ( size_t  newSize,
uint64_t  location,
uint64_t  size 
)
virtual

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 93 of file FatFile.cc.

References extend().

void FatFile::pinBlock ( uint64_t  location)
virtual

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.

Reimplemented from File.

Definition at line 72 of file FatFile.cc.

References Cache::pin().

uintptr_t FatFile::readBlock ( uint64_t  location)
virtual

Internal function to retrieve an aligned 512byte section of the file.

Reimplemented from File.

Definition at line 44 of file FatFile.cc.

References File::getBlockSize(), Cache::insert(), and Cache::markNoLongerEditing().

void FatFile::sync ( size_t  offset,
bool  async 
)
virtual

Trigger a sync of an inner cache back to disk.

Reimplemented from File.

Definition at line 67 of file FatFile.cc.

References Cache::sync().

void FatFile::unpinBlock ( uint64_t  location)
virtual

Unpins the given page.

Reimplemented from File.

Definition at line 77 of file FatFile.cc.

References Cache::release().

void FatFile::writeBlock ( uint64_t  location,
uintptr_t  addr 
)
virtual

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 55 of file FatFile.cc.

References File::getBlockSize().


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