![]() |
Max OS 0.3
|
Handles the directory operations on the FAT32 filesystem. More...
#include <fat32.h>
Public Member Functions | |
| Fat32Directory (Fat32Volume *volume, lba_t cluster, const string &name) | |
| Construct a new Fat32 Directory object. | |
| void | read_from_disk () final |
| read the directory from 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 the subdirectory. | |
| 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. | |
| lba_t | first_cluster () const |
| Get the first cluster of the directory. | |
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. | |
| virtual void | rename_file (const string &old_name, 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. | |
| virtual void | rename_subdirectory (const string &old_name, 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. | |
Protected Member Functions | |
| void | save_entry_to_disk (dir_entry_t *entry) |
| Writes an updated directory entry to the disk. | |
| void | update_entry_on_disk (size_t index) |
| Save the directory entry at the given index to the disk. | |
Friends | |
| class | Fat32File |
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. | |
| Fat32Directory::Fat32Directory | ( | Fat32Volume * | volume, |
| lba_t | cluster, | ||
| const string & | name | ||
| ) |
Construct a new Fat32 Directory object.
| volume | The FAT32 volume |
| cluster | The cluster of the directory |
| name | The name of the directory |
Definition at line 424 of file fat32.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 890 of file fat32.cpp.
References MaxOS::filesystem::Directory::m_files, MaxOS::filesystem::format::MAX_NAME_LENGTH, 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 933 of file fat32.cpp.
References MaxOS::filesystem::Directory::m_subdirectories, MaxOS::filesystem::format::MAX_NAME_LENGTH, and MaxOS::filesystem::Directory::name().
|
inline |
Get the first cluster of the directory.
Definition at line 279 of file fat32.h.
Referenced by remove_file(), and remove_subdirectory().
|
finalvirtual |
read the directory from the disk
Reimplemented from MaxOS::filesystem::Directory.
Definition at line 829 of file fat32.cpp.
References MaxOS::filesystem::Directory::m_files, MaxOS::filesystem::Directory::m_subdirectories, and MaxOS::filesystem::Directory::name().
Delete a file from the subdirectory.
| name | The name of the file to delete |
Reimplemented from MaxOS::filesystem::Directory.
Definition at line 912 of file fat32.cpp.
References first_cluster(), MaxOS::filesystem::Directory::m_files, and 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 959 of file fat32.cpp.
References first_cluster(), MaxOS::filesystem::Directory::m_subdirectories, and MaxOS::filesystem::Directory::name().
|
protected |
Writes an updated directory entry to the disk.
| entry | The entry to write |
Definition at line 589 of file fat32.cpp.
References update_entry_on_disk().
Referenced by MaxOS::filesystem::format::Fat32File::write().
Save the directory entry at the given index to the disk.
| index | The index of the entry to update |
Definition at line 605 of file fat32.cpp.
References MaxOS::filesystem::format::Fat32Volume::bpb, MaxOS::filesystem::format::Fat32Volume::data_lba, MaxOS::filesystem::format::Fat32Volume::disk, MaxOS::filesystem::format::Fat32Volume::next_cluster(), MaxOS::drivers::disk::Disk::read(), and MaxOS::drivers::disk::Disk::write().
Referenced by save_entry_to_disk().