The Pedigree Project
0.1
|
#include <Ext2Filesystem.h>
Public Member Functions | |
virtual bool | initialise (Disk *pDisk) |
virtual File * | getRoot () const |
virtual String | getVolumeLabel () const |
Public Member Functions inherited from Filesystem | |
Filesystem () | |
virtual | ~Filesystem () |
virtual File * | find (const StringView &path) |
virtual File * | find (const String &path) |
virtual File * | find (const StringView &path, File *pStartNode) |
virtual File * | find (const String &path, File *pStartNode) |
bool | createFile (const StringView &path, uint32_t mask, File *pStartNode=0) |
bool | createDirectory (const StringView &path, uint32_t mask, File *pStartNode=0) |
bool | createSymlink (const StringView &path, const String &value, File *pStartNode=0) |
bool | createLink (const StringView &path, File *target, File *pStartNode=0) |
bool | remove (const StringView &path, File *pStartNode=0) |
Disk * | getDisk () |
bool | isReadOnly () |
virtual bool | isCaseSensitive () |
Static Public Member Functions | |
static Filesystem * | probe (Disk *pDisk) |
Protected Member Functions | |
virtual bool | createFile (File *parent, const String &filename, uint32_t mask) |
virtual bool | createDirectory (File *parent, const String &filename, uint32_t mask) |
virtual bool | createSymlink (File *parent, const String &filename, const String &value) |
virtual bool | createLink (File *parent, const String &filename, File *target) |
virtual bool | remove (File *parent, File *file) |
Private Member Functions | |
virtual bool | createNode (File *parent, const String &filename, uint32_t mask, const String &value, size_t type, uint32_t inodeOverride=0) |
Ext2Filesystem (const Ext2Filesystem &) | |
void | operator= (const Ext2Filesystem &) |
uintptr_t | readBlock (uint32_t block) |
void | writeBlock (uint32_t block) |
void | pinBlock (uint64_t location) |
void | unpinBlock (uint64_t location) |
void | sync (size_t offset, bool async) |
uint32_t | findFreeBlock (uint32_t inode) |
bool | findFreeBlocks (uint32_t inode, size_t count, Vector< uint32_t > &blocks) |
size_t | findFreeBlocksInGroup (uint32_t group, size_t maxCount, Vector< uint32_t > &blocks) |
uint32_t | findFreeInode () |
void | releaseBlock (uint32_t block) |
bool | releaseInode (uint32_t inode) |
Inode * | getInode (uint32_t num) |
void | writeInode (uint32_t num) |
void | ensureFreeBlockBitmapLoaded (size_t group) |
void | ensureFreeInodeBitmapLoaded (size_t group) |
void | ensureInodeTableLoaded (size_t group) |
bool | checkOptionalFeature (size_t feature) |
bool | checkRequiredFeature (size_t feature) |
bool | checkReadOnlyFeature (size_t feature) |
void | increaseInodeRefcount (uint32_t inode) |
bool | decreaseInodeRefcount (uint32_t inode) |
Private Attributes | |
Superblock * | m_pSuperblock |
GroupDesc ** | m_pGroupDescriptors |
Vector< size_t > * | m_pInodeTables |
Vector< size_t > * | m_pInodeBitmaps |
Vector< size_t > * | m_pBlockBitmaps |
uint32_t | m_BlockSize |
uint32_t | m_InodeSize |
size_t | m_nGroupDescriptors |
Mutex | m_WriteLock |
File * | m_pRoot |
String | m_VolumeLabel |
Friends | |
class | Ext2File |
class | Ext2Node |
class | Ext2Directory |
class | Ext2Symlink |
Additional Inherited Members | |
Public Types inherited from Filesystem | |
typedef Filesystem *(* | ProbeCallback) (Disk *) |
Protected Attributes inherited from Filesystem | |
bool | m_bReadOnly |
Disk * | m_pDisk |
This class provides an implementation of the second extended filesystem.
Definition at line 37 of file Ext2Filesystem.h.
|
private |
Inaccessible copy constructor and operator=
|
protectedvirtual |
createDirectory calls this after it has parsed the string path.
Implements Filesystem.
Definition at line 448 of file Ext2Filesystem.cc.
|
protectedvirtual |
createFile calls this after it has parsed the string path.
Implements Filesystem.
Definition at line 442 of file Ext2Filesystem.cc.
|
protectedvirtual |
createLink calls this after it has parsed the string path.
Reimplemented from Filesystem.
Definition at line 464 of file Ext2Filesystem.cc.
References File::isDirectory(), and File::isSymlink().
|
privatevirtual |
Definition at line 257 of file Ext2Filesystem.cc.
References Ext2Directory::addEntry(), Ext2Node::ensureLargeEnough(), ERROR, Ext2File::Ext2File(), FATAL, Hex, Processor::information(), File::isDirectory(), File::isSymlink(), NOTICE, File::setAccessedTime(), File::setModifiedTime(), File::write(), and Ext2File::writeBlock().
|
protectedvirtual |
createSymlink calls this after it has parsed the string path.
Implements Filesystem.
Definition at line 458 of file Ext2Filesystem.cc.
|
private |
Definition at line 604 of file Ext2Filesystem.cc.
References ERROR.
Referenced by Ext2Node::ensureLargeEnough().
|
private |
Definition at line 635 of file Ext2Filesystem.cc.
References Vector< T >::pushBack(), and Ext2File::writeBlock().
|
private |
Definition at line 773 of file Ext2Filesystem.cc.
References assert, and Ext2File::writeBlock().
|
virtual |
Returns the root filesystem node.
Implements Filesystem.
Definition at line 247 of file Ext2Filesystem.cc.
|
virtual |
Returns a string identifying the volume label.
Implements Filesystem.
Definition at line 252 of file Ext2Filesystem.cc.
|
virtual |
Populates this filesystem with data from the given Disk device.
Implements Filesystem.
Definition at line 85 of file Ext2Filesystem.cc.
References assert, ERROR, Disk::getName(), initialise(), NOTICE, Ext2File::readBlock(), and WARNING.
Referenced by initialise().
|
private |
Reads a block of data from the disk.
Definition at line 557 of file Ext2Filesystem.cc.
Referenced by Ext2Directory::addEntry(), Ext2Directory::cacheDirectoryContents(), Ext2Node::ensureLargeEnough(), Ext2Directory::removeEntry(), and Ext2Node::~Ext2Node().
|
private |
Definition at line 860 of file Ext2Filesystem.cc.
References Dec, ERROR, FATAL, Hex, and Ext2File::writeBlock().
Referenced by Ext2Node::wipe().
|
private |
Releases the given inode, returns true if the inode had no more links.
Definition at line 915 of file Ext2Filesystem.cc.
References VFS::addProbeCallback(), assert, VFS::instance(), Ext2File::pinBlock(), Vector< T >::pushBack(), Ext2File::readBlock(), Vector< T >::size(), WARNING, and Ext2File::writeBlock().
Referenced by Ext2Directory::removeEntry().
Remove a file given a parent and file, assuming path parsing already completed.
Implements Filesystem.
Definition at line 500 of file Ext2Filesystem.cc.
References File::getName(), File::isDirectory(), File::isSymlink(), NOTICE, Ext2Directory::removeEntry(), and Ext2File::writeBlock().
|
private |
Writes a block of data to the disk.
Definition at line 566 of file Ext2Filesystem.cc.
Referenced by Ext2Directory::addEntry(), Ext2Node::ensureLargeEnough(), Ext2Directory::removeEntry(), and Ext2Node::~Ext2Node().
|
private |
Size of a block.
Definition at line 126 of file Ext2Filesystem.h.
Referenced by Ext2Directory::addEntry(), Ext2Directory::cacheDirectoryContents(), Ext2Node::ensureLargeEnough(), Ext2Node::Ext2Node(), Ext2Node::fileAttributeChanged(), Ext2File::getBlockSize(), Ext2Symlink::readBytewise(), Ext2Directory::removeEntry(), Ext2Node::updateMetadata(), Ext2Symlink::writeBytewise(), and Ext2Node::~Ext2Node().
|
private |
Size of an Inode.
Definition at line 129 of file Ext2Filesystem.h.
|
private |
Number of group descriptors.
Definition at line 132 of file Ext2Filesystem.h.
|
private |
Free block bitmaps, indexed by group descriptor.
Definition at line 123 of file Ext2Filesystem.h.
|
private |
Group descriptors, in a tree because each GroupDesc* may be in a different block.
Definition at line 116 of file Ext2Filesystem.h.
|
private |
Free inode bitmaps, indexed by group descriptor.
Definition at line 121 of file Ext2Filesystem.h.
|
private |
Inode tables, indexed by group descriptor.
Definition at line 119 of file Ext2Filesystem.h.
|
private |
The root filesystem node.
Definition at line 141 of file Ext2Filesystem.h.
|
private |
Our superblock.
Definition at line 112 of file Ext2Filesystem.h.
|
private |
Cached volume label.
Definition at line 144 of file Ext2Filesystem.h.
|
private |
Write lock - we're finding some inodes and updating the superblock and block group structures.
Definition at line 137 of file Ext2Filesystem.h.