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

#include <Ext2Node.h>

+ Inheritance diagram for Ext2Node:
+ Collaboration diagram for Ext2Node:

Public Member Functions

 Ext2Node (uintptr_t inode_num, Inode *pInode, class Ext2Filesystem *pFs)
 
virtual ~Ext2Node ()
 
InodegetInode ()
 
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

Inodem_pInode
 
uint32_t m_InodeNumber
 
class Ext2Filesystemm_pExt2Fs
 
Vector< uint32_t > m_Blocks
 
uint32_t m_nMetadataBlocks
 
size_t m_nSize
 

Private Member Functions

 Ext2Node (const Ext2Node &file)
 
Ext2Nodeoperator= (const Ext2Node &)
 

Friends

class Ext2Filesystem
 

Detailed Description

A node in an ext2 filesystem.

Definition at line 29 of file Ext2Node.h.

Constructor & Destructor Documentation

Ext2Node::Ext2Node ( const Ext2Node file)
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().

Ext2Node::~Ext2Node ( )
virtual

Member Function Documentation

bool Ext2Node::ensureLargeEnough ( size_t  size,
uint64_t  location,
uint64_t  opsize,
bool  onlyBlocks = false,
bool  nozeroblocks = false 
)
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().

+ Here is the caller graph for this function:

void Ext2Node::fileAttributeChanged ( size_t  size,
size_t  atime,
size_t  mtime,
size_t  ctime 
)

Updates inode attributes.

Todo:
4GB files.

Definition at line 478 of file Ext2Node.cc.

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

Referenced by ensureLargeEnough().

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:


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