10#ifndef MAXOS_FILESYSTEM_VFS_H
11#define MAXOS_FILESYSTEM_VFS_H
18namespace MaxOS::filesystem {
Stores the left, top, width and height of a rectangle.
Handles a group of files (directory)
Handles the disk operations and file system information.
Handles file operations and information.
Combines all the filesystems across the partitions on each disk into a single filesystems and exposes...
~VirtualFileSystem()
Destroy the Virtual File System object and unmount all filesystems.
void unmount_all()
Remove all mounted filesystems.
Directory * open_directory(const string &path)
Try to open a directory on the virtual file system and read it's contents.
FileSystem * root_filesystem()
Get the filesystem mounted at the root.
FileSystem * get_filesystem(const string &mount_point)
Get a specific filesystem mounted at a given mount point.
void unmount_filesystem(FileSystem *filesystem)
Remove a filesystem from the virtual file system & delete it.
void mount_filesystem(FileSystem *filesystem)
Add a filesystem to the virtual file system.
FileSystem * find_filesystem(string path)
Find the filesystem that is responsible for a given path.
File * open_file(const string &path, size_t offset=0)
Try to open a file on the virtual file system with a given offset.
Directory * create_directory(string path)
Attempts to open the parent directory and creates the sub directory at the end of the path.
string get_relative_path(FileSystem *filesystem, string path)
Get the relative path on a filesystem for a given VFS path (ie remove the mount point)
Directory * root_directory()
Get the root directory of the virtual file system.
void delete_file(const string &path)
Opens a directory on the vfs and deletes the file at the end of the path.
File * create_file(const string &path)
Attempts to open the parent directory and create the file at the end of the path.
void delete_directory(string path)
Attempts to open the parent directory and deletes the sub directory at the end of the path.
static VirtualFileSystem * current_file_system()
Get the active virtual file system.
VirtualFileSystem()
Construct a new Virtual File System object and set it as the current file system.
Defines a generic API for a file system, including classes for File, Directory, and FileSystem.
Defines a Map class for storing key-value pairs.
Defines a Pair class for storing two related objects together.