![]() |
Max OS 0.3
|
Simplfies the management of an inode & its blocks. More...
#include <ext2.h>
Public Member Functions | |
| InodeHandler (Ext2Volume *volume, uint32_t inode) | |
| Construct a new Inode Handler object. Reads the inode and caches the block pointers. | |
| size_t | size () const |
| read the size upper and lower into a single size_t | |
| void | set_size (size_t size) |
| store the size of the inode data. (does not write to disk) | |
| size_t | grow (size_t amount, bool flush=true) |
| Increase the size of the inode's storage capacity by allocating new blocks. | |
| void | save () |
| Writes the inode meta data to disk. | |
| void | free () |
| Marks this inode's blocks as free and then the inode as free. | |
Public Attributes | |
| uint32_t | inode_number |
| The index of the inode. | |
| inode_t | inode |
| The inode metadata for this file/directory. | |
| common::Vector< uint32_t > | block_cache |
| All the blocks used by this inode. | |
| InodeHandler::InodeHandler | ( | Ext2Volume * | volume, |
| uint32_t | inode_index | ||
| ) |
Construct a new Inode Handler object. Reads the inode and caches the block pointers.
| volume | The volume the inode belongs to |
| inode_index | The inode index |
Definition at line 509 of file ext2.cpp.
References block_cache, MaxOS::filesystem::format::ext2::Ext2Volume::block_size, inode, and MaxOS::common::Vector< Type >::push_back().
| void InodeHandler::free | ( | ) |
Marks this inode's blocks as free and then the inode as free.
Definition at line 705 of file ext2.cpp.
References block_cache, MaxOS::filesystem::format::ext2::Ext2Volume::ext2_lock, MaxOS::filesystem::format::ext2::Ext2Volume::free_blocks(), MaxOS::filesystem::format::ext2::Ext2Volume::free_inode(), inode_number, MaxOS::common::Spinlock::lock(), and MaxOS::common::Spinlock::unlock().
Increase the size of the inode's storage capacity by allocating new blocks.
| amount | The amount to grow to in bytes |
| flush | Save the newly allocated chunks to disk, defaults to true |
Definition at line 675 of file ext2.cpp.
References MaxOS::filesystem::format::ext2::Ext2Volume::allocate_blocks(), ASSERT, MaxOS::filesystem::format::ext2::Ext2Volume::bytes_to_blocks(), save(), set_size(), and size().
Referenced by MaxOS::filesystem::format::ext2::Ext2File::write().
| void InodeHandler::save | ( | ) |
Writes the inode meta data to disk.
Definition at line 697 of file ext2.cpp.
References inode, inode_number, and MaxOS::filesystem::format::ext2::Ext2Volume::write_inode().
Referenced by grow(), and MaxOS::filesystem::format::ext2::Ext2File::write().
| size_t InodeHandler::size | ( | ) | const |
read the size upper and lower into a single size_t
Definition at line 529 of file ext2.cpp.
References inode.
Referenced by MaxOS::filesystem::format::ext2::Ext2File::Ext2File(), grow(), and set_size().
| common::Vector<uint32_t> MaxOS::filesystem::format::ext2::InodeHandler::block_cache |
All the blocks used by this inode.
Definition at line 387 of file ext2.h.
Referenced by free(), InodeHandler(), MaxOS::filesystem::format::ext2::Ext2File::read(), MaxOS::filesystem::format::ext2::Ext2Directory::read_from_disk(), and MaxOS::filesystem::format::ext2::Ext2File::write().
| inode_t MaxOS::filesystem::format::ext2::InodeHandler::inode |
The inode metadata for this file/directory.
Definition at line 386 of file ext2.h.
Referenced by InodeHandler(), save(), set_size(), size(), and MaxOS::filesystem::format::ext2::Ext2File::write().
| uint32_t MaxOS::filesystem::format::ext2::InodeHandler::inode_number |
The index of the inode.
Definition at line 385 of file ext2.h.
Referenced by MaxOS::filesystem::format::ext2::Ext2Directory::create_subdirectory(), free(), and save().