![]() |
Max OS 0.3
|
Handles the directory operations on the ext2 filesystem. More...
#include <ext2.h>
Public Member Functions | |
| Ext2Directory (Ext2Volume *volume, uint32_t inode, const string &name) | |
| Construct a new Ext2 Directory object. | |
| void | read_from_disk () final |
| read the directory from the inode on the disk | |
| File * | create_file (const string &name) final |
| Create a new file in the directory. | |
| void | remove_file (const string &name) final |
| Delete a file from this directory. | |
| void | rename_file (const string &old_name, const string &new_name) final |
| Renames the file from the old name to the new name if it exists. | |
| Directory * | create_subdirectory (const string &name) final |
| Create a new directory in the directory. | |
| void | remove_subdirectory (const string &name) final |
| Remove a directory entry from the directory. | |
| void | rename_subdirectory (const string &old_name, const string &new_name) final |
| Renames the directory from the old name to the new name if it exists. | |
Public Member Functions inherited from MaxOS::filesystem::Directory | |
| virtual | ~Directory () |
| Destructor for Directory, frees all files and subdirectories. | |
| common::Vector< File * > | files () |
| Get the files in the directory. | |
| common::Vector< Directory * > | subdirectories () |
| Get the subdirectories in the directory. | |
| File * | open_file (const string &name) |
| Open a file in the directory. | |
| Directory * | open_subdirectory (const string &name) |
| Open a directory in the directory. | |
| void | rename_file (File *file, const string &new_name) |
| Rename a file in the directory. | |
| void | rename_subdirectory (Directory *directory, const string &new_name) |
| Rename a subdirectory in the directory. | |
| string | name () |
| Get the name of the directory. | |
| size_t | size () |
| Get the size of the directory. | |
Additional Inherited Members | |
Protected Attributes inherited from MaxOS::filesystem::Directory | |
| common::Vector< File * > | m_files |
| The files in this directory. | |
| common::Vector< Directory * > | m_subdirectories |
| The subdirectories in this directory. | |
| string | m_name |
| The name of this directory. | |
| Ext2Directory::Ext2Directory | ( | Ext2Volume * | volume, |
| uint32_t | inode, | ||
| const string & | name | ||
| ) |
Construct a new Ext2 Directory object.
| volume | The volume the directory exists on |
| inode | The inode number of the directory (will be used to setup the internal InodeHandler) |
| name | The name of the directory |
Definition at line 854 of file ext2.cpp.
References MaxOS::filesystem::Directory::m_name, and MaxOS::filesystem::Directory::name().
Create a new file in the directory.
| name | The name of the file to create |
Reimplemented from MaxOS::filesystem::Directory.
Definition at line 1090 of file ext2.cpp.
References MaxOS::filesystem::Directory::m_files, and MaxOS::filesystem::Directory::name().
Create a new directory in the directory.
| name | The name of the directory to create |
Reimplemented from MaxOS::filesystem::Directory.
Definition at line 1128 of file ext2.cpp.
References MaxOS::filesystem::format::ext2::InodeHandler::inode_number, MaxOS::filesystem::Directory::m_subdirectories, and MaxOS::filesystem::Directory::name().
|
finalvirtual |
read the directory from the inode on the disk
Reimplemented from MaxOS::filesystem::Directory.
Definition at line 959 of file ext2.cpp.
References MaxOS::filesystem::format::ext2::InodeHandler::block_cache, MaxOS::filesystem::format::ext2::Ext2Volume::block_size, MaxOS::common::Vector< Type >::clear(), MaxOS::filesystem::format::ext2::Ext2Volume::ext2_lock, MaxOS::common::Spinlock::lock(), MaxOS::filesystem::Directory::m_files, MaxOS::filesystem::Directory::m_subdirectories, MaxOS::filesystem::format::ext2::Ext2Volume::read_block(), and MaxOS::common::Spinlock::unlock().
Delete a file from this directory.
| name | The name of the file to delete |
Reimplemented from MaxOS::filesystem::Directory.
Definition at line 1108 of file ext2.cpp.
References MaxOS::filesystem::Directory::name().
Remove a directory entry from the directory.
| name | The name of the entry to remove |
Reimplemented from MaxOS::filesystem::Directory.
Definition at line 1151 of file ext2.cpp.
References MaxOS::filesystem::Directory::name().
Renames the file from the old name to the new name if it exists.
| old_name | The current name of the file that is to be changed |
| new_name | What the new name should be |
Reimplemented from MaxOS::filesystem::Directory.
|
finalvirtual |
Renames the directory from the old name to the new name if it exists.
| old_name | The current name of the directory that is to be changed |
| new_name | What the new name should be |
Reimplemented from MaxOS::filesystem::Directory.