![]() |
Max OS 0.3
|
Handles the file operations on the ext2 filesystem. More...
#include <ext2.h>
Public Member Functions | |
| Ext2File (Ext2Volume *volume, uint32_t inode, const string &name) | |
| Construct a new Ext2 File object. | |
| void | write (common::buffer_t *data, size_t amount) final |
| write data to the file (at the current seek position, updated to be += amount) | |
| void | read (common::buffer_t *data, size_t amount) final |
| read data from the file (at the current seek position, updated to be += amount) | |
| void | flush () final |
| Flush the file to the disk. | |
Public Member Functions inherited from MaxOS::filesystem::File | |
| void | seek (SeekType seek_type, size_t offset) |
| Seek to a position in the file. | |
| uint32_t | position () const |
| Get where the file is currently at (amount read/write/seeked) | |
| size_t | size () const |
| Get the size of the file. | |
| string | name () |
| Get the name of the file. | |
Additional Inherited Members | |
Protected Attributes inherited from MaxOS::filesystem::File | |
| uint32_t | m_offset = 0 |
| The current offset in the file. | |
| string | m_name |
| The name of the file. | |
| size_t | m_size = 0 |
| The size of the file. | |
| Ext2File::Ext2File | ( | Ext2Volume * | volume, |
| uint32_t | inode, | ||
| const string & | name | ||
| ) |
Construct a new Ext2 File object.
| volume | The volume the file exists on |
| inode | The inode number of the file (will be used to setup the internal InodeHandler) |
| name | The name of the file |
Definition at line 725 of file ext2.cpp.
References MaxOS::filesystem::File::m_name, MaxOS::filesystem::File::m_size, MaxOS::filesystem::File::name(), and MaxOS::filesystem::format::ext2::InodeHandler::size().
|
finalvirtual |
Flush the file to the disk.
Reimplemented from MaxOS::filesystem::File.
Definition at line 841 of file ext2.cpp.
References MaxOS::filesystem::File::flush().
|
finalvirtual |
read data from the file (at the current seek position, updated to be += amount)
| data | The byte buffer to read into |
| amount | The amount of data to read |
Reimplemented from MaxOS::filesystem::File.
Definition at line 795 of file ext2.cpp.
References MaxOS::filesystem::format::ext2::InodeHandler::block_cache, MaxOS::filesystem::format::ext2::Ext2Volume::block_size, MaxOS::common::Buffer::copy_to(), MaxOS::filesystem::format::ext2::Ext2Volume::ext2_lock, MaxOS::common::Spinlock::lock(), MaxOS::filesystem::File::m_offset, MaxOS::filesystem::File::m_size, read(), MaxOS::filesystem::format::ext2::Ext2Volume::read_block(), and MaxOS::common::Spinlock::unlock().
Referenced by read().
|
finalvirtual |
write data to the file (at the current seek position, updated to be += amount)
| data | The byte buffer to write |
| amount | The amount of data to write |
Reimplemented from MaxOS::filesystem::File.
Definition at line 741 of file ext2.cpp.
References MaxOS::drivers::clock::Clock::active_clock(), MaxOS::filesystem::format::ext2::InodeHandler::block_cache, MaxOS::filesystem::format::ext2::Ext2Volume::block_size, MaxOS::common::Buffer::copy_from(), MaxOS::filesystem::format::ext2::Ext2Volume::ext2_lock, MaxOS::filesystem::format::ext2::InodeHandler::grow(), MaxOS::filesystem::format::ext2::InodeHandler::inode, MaxOS::common::Spinlock::lock(), MaxOS::filesystem::File::m_offset, MaxOS::filesystem::File::m_size, MaxOS::filesystem::format::ext2::Ext2Volume::read_block(), MaxOS::filesystem::format::ext2::InodeHandler::save(), MaxOS::common::Spinlock::unlock(), and MaxOS::filesystem::format::ext2::Ext2Volume::write_block().