The Pedigree Project
0.1
|
#include <Ext2File.h>
Public Member Functions | |
Ext2File (const String &name, uintptr_t inode_num, Inode *inode, class Ext2Filesystem *pFs, File *pParent=0) | |
virtual | ~Ext2File () |
virtual void | preallocate (size_t expectedSize, bool zero=true) |
virtual void | extend (size_t newSize) |
virtual void | extend (size_t newSize, uint64_t location, uint64_t size) |
virtual void | truncate () |
void | fileAttributeChanged () |
virtual uintptr_t | readBlock (uint64_t location) |
virtual void | writeBlock (uint64_t location, uintptr_t addr) |
virtual void | pinBlock (uint64_t location) |
virtual void | unpinBlock (uint64_t location) |
virtual void | sync (size_t offset, bool async) |
virtual size_t | getBlockSize () const |
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) |
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) |
Filesystem * | getFilesystem () const |
void | setFilesystem (Filesystem *pFs) |
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 |
File * | getParent () 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) |
void | enableDirect () |
void | disableDirect () |
virtual File * | open () |
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) |
void | updateMetadata (uint16_t uid, uint16_t gid, uint32_t perms) |
void | wipe () |
void | extend (size_t newSize) |
void | extend (size_t newSize, uint64_t location, uint64_t size) |
uintptr_t | readBlock (uint64_t location) |
void | writeBlock (uint64_t location) |
void | trackBlock (uint32_t block) |
void | pinBlock (uint64_t location) |
void | unpinBlock (uint64_t location) |
void | sync (size_t offset, bool async) |
Private Member Functions | |
Ext2File (const Ext2File &file) | |
Ext2File & | operator= (const Ext2File &) |
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) |
Protected Member Functions inherited from Ext2Node | |
bool | ensureLargeEnough (size_t size, uint64_t location, uint64_t opsize, bool onlyBlocks=false, bool nozeroblocks=false) |
bool | addBlock (uint32_t blockValue) |
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) |
uint32_t | modeToPermissions (uint32_t mode) const |
uint32_t | permissionsToMode (uint32_t permissions) const |
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 Filesystem * | m_pFilesystem |
size_t | m_Size |
File * | m_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 |
Protected Attributes inherited from Ext2Node | |
Inode * | m_pInode |
uint32_t | m_InodeNumber |
class Ext2Filesystem * | m_pExt2Fs |
Vector< uint32_t > | m_Blocks |
uint32_t | m_nMetadataBlocks |
size_t | m_nSize |
A File is a file, a directory or a symlink.
Definition at line 31 of file Ext2File.h.
|
private |
Copy constructors are hidden - unused!
Referenced by Ext2Filesystem::createNode().
Ext2File::Ext2File | ( | const String & | name, |
uintptr_t | inode_num, | ||
Inode * | inode, | ||
class Ext2Filesystem * | pFs, | ||
File * | pParent = 0 |
||
) |
Constructor, should be called only by a Filesystem.
Definition at line 27 of file Ext2File.cc.
References File::setGidOnly(), File::setPermissionsOnly(), and File::setUidOnly().
|
virtual |
Destructor
Definition at line 44 of file Ext2File.cc.
|
virtual |
Internal function to extend a file to be at least the given size.
Reimplemented from File.
Definition at line 54 of file Ext2File.cc.
|
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 60 of file Ext2File.cc.
|
virtual |
Updates inode attributes.
Reimplemented from File.
Definition at line 73 of file Ext2File.cc.
References Ext2Node::updateMetadata().
|
virtual |
Function to retrieve the block size returned by readBlock.
Reimplemented from File.
Definition at line 106 of file Ext2File.cc.
References Ext2Filesystem::m_BlockSize.
|
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 91 of file Ext2File.cc.
Referenced by Ext2Filesystem::releaseInode().
|
virtual |
Optionally preallocates blocks to fit the given size.
Reimplemented from File.
Definition at line 48 of file Ext2File.cc.
References Ext2Node::ensureLargeEnough().
|
virtual |
Internal function to retrieve an aligned 512byte section of the file.
Reimplemented from File.
Definition at line 81 of file Ext2File.cc.
Referenced by Ext2Filesystem::initialise(), and Ext2Filesystem::releaseInode().
|
virtual |
Trigger a sync of an inner cache back to disk.
Reimplemented from File.
Definition at line 101 of file Ext2File.cc.
|
virtual |
Delete all data from the file.
Reimplemented from File.
Definition at line 66 of file Ext2File.cc.
References Ext2Node::wipe().
|
virtual |
|
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 86 of file Ext2File.cc.
Referenced by Ext2Filesystem::createNode(), Ext2Filesystem::findFreeBlocksInGroup(), Ext2Filesystem::findFreeInode(), Ext2Filesystem::releaseBlock(), Ext2Filesystem::releaseInode(), and Ext2Filesystem::remove().