The Pedigree Project
0.1
|
#include <Ext2Node.h>
Public Member Functions | |
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) |
Protected Member Functions | |
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 |
Protected Attributes | |
Inode * | m_pInode |
uint32_t | m_InodeNumber |
class Ext2Filesystem * | m_pExt2Fs |
Vector< uint32_t > | m_Blocks |
uint32_t | m_nMetadataBlocks |
size_t | m_nSize |
Private Member Functions | |
Ext2Node (const Ext2Node &file) | |
Ext2Node & | operator= (const Ext2Node &) |
Friends | |
class | Ext2Filesystem |
A node in an ext2 filesystem.
Definition at line 29 of file Ext2Node.h.
|
private |
Copy constructors are hidden - unused!
Ext2Node::Ext2Node | ( | uintptr_t | inode_num, |
Inode * | pInode, | ||
class Ext2Filesystem * | pFs | ||
) |
Constructor, should be called only by a Filesystem.
Definition at line 30 of file Ext2Node.cc.
References Ext2Filesystem::m_BlockSize, Vector< T >::pushBack(), and Vector< T >::reserve().
|
virtual |
Destructor
Definition at line 57 of file Ext2Node.cc.
References Vector< T >::count(), ERROR, Ext2Filesystem::m_BlockSize, Vector< T >::pushBack(), Ext2Filesystem::readBlock(), and Ext2Filesystem::writeBlock().
|
protected |
Ensures the inode is at least 'size' big. Set onlyBlocks to true to not change the actual data size, which can be useful for preallocation.
Definition at line 144 of file Ext2Node.cc.
References assert, Vector< T >::count(), ERROR, FATAL, fileAttributeChanged(), Ext2Filesystem::findFreeBlocks(), LIKELY, Ext2Filesystem::m_BlockSize, Vector< T >::pushBack(), Ext2Filesystem::readBlock(), and Ext2Filesystem::writeBlock().
Referenced by Ext2Filesystem::createNode(), Ext2File::preallocate(), and wipe().
void Ext2Node::fileAttributeChanged | ( | size_t | size, |
size_t | atime, | ||
size_t | mtime, | ||
size_t | ctime | ||
) |
Updates inode attributes.
Definition at line 478 of file Ext2Node.cc.
References Vector< T >::count(), and Ext2Filesystem::m_BlockSize.
Referenced by ensureLargeEnough().
void Ext2Node::updateMetadata | ( | uint16_t | uid, |
uint16_t | gid, | ||
uint32_t | perms | ||
) |
Updates inode metadata.
Definition at line 497 of file Ext2Node.cc.
References Vector< T >::count(), and Ext2Filesystem::m_BlockSize.
Referenced by Ext2File::fileAttributeChanged(), Ext2Symlink::fileAttributeChanged(), and Ext2Directory::fileAttributeChanged().
void Ext2Node::wipe | ( | ) |
Wipes the node of data - frees all blocks.
Definition at line 115 of file Ext2Node.cc.
References Vector< T >::clear(), Vector< T >::count(), ensureLargeEnough(), and Ext2Filesystem::releaseBlock().
Referenced by Ext2Directory::removeEntry(), Ext2File::truncate(), and Ext2Symlink::truncate().