This class is used to emulate interactions with the rootfs specified by user.
More...
#include <file_system_manager.hpp>
|
| std::map< int, std::shared_ptr< ARION_FILE > > | files |
| | A map identifying an open file given its UNIX file descriptor.
|
| |
|
| std::weak_ptr< Arion > | arion |
| | The Arion instance used for emulation.
|
| |
| std::string | fs_path |
| | Path to the user specified rootfs.
|
| |
| std::string | cwd_path |
| | Path to the user specifed current working directory.
|
| |
| std::unique_ptr< ProcFSManager > | procfs |
| | Used to emulate the behavior of the procfs filesystem.
|
| |
This class is used to emulate interactions with the rootfs specified by user.
◆ FileSystemManager()
| arion::FileSystemManager::FileSystemManager |
( |
std::weak_ptr< Arion > |
arion, |
|
|
std::string |
fs_path, |
|
|
std::string |
cwd_path |
|
) |
| |
Builder for FileSystemManager instances.
- Parameters
-
| [in] | arion | The Arion instance used for emulation. |
| [in] | fs_path | Path to the user specified rootfs. |
| [in] | cwd_path | Path to the user specifed current working directory. |
◆ add_file_entry()
| void arion::FileSystemManager::add_file_entry |
( |
int |
target_fd, |
|
|
std::shared_ptr< ARION_FILE > |
file, |
|
|
bool |
safe = true |
|
) |
| |
Inserts a new open file to the "files" vector.
- Parameters
-
| [in] | target_fd | The UNIX file descriptor for the new file, in the emulation context. |
| [in] | file | The new file to be inserted. |
| [in] | safe | If true, additional checks are performed to make sure the file can be inserted safely. |
◆ can_access_file()
| bool arion::FileSystemManager::can_access_file |
( |
std::string |
path | ) |
|
|
private |
Checks whether a given path can be accessed by the user or not, based on his rights.
- Parameters
-
| [in] | path | The path whose accessibility is to be checked. |
- Returns
- True if the user is allowed to access the given path.
◆ find_fd_path()
| static std::string arion::FileSystemManager::find_fd_path |
( |
int |
fd | ) |
|
|
static |
Converts a file descriptor from the emulator context (not the emulation one) into its corresponding system path.
- Parameters
-
| [in] | fd | The file descriptor to convert. |
- Returns
- The retrieved system path.
◆ get_arion_file()
| std::shared_ptr< ARION_FILE > arion::FileSystemManager::get_arion_file |
( |
int |
target_fd | ) |
|
Retrieves an ARION_FILE instance from a UNIX file descriptor from the emulation context.
- Parameters
-
| [in] | target_fd | The UNIX file descriptor. |
- Returns
- The retrieved ARION_FILE.
◆ get_cwd_path()
| std::string arion::FileSystemManager::get_cwd_path |
( |
| ) |
|
Retrieves the user specified path to the current working directory.
- Returns
- Path to the current working directory.
◆ get_fs_path()
| std::string arion::FileSystemManager::get_fs_path |
( |
| ) |
|
Retrieves the user specified path to rootfs.
- Returns
- Path to the rootfs.
◆ has_file_entry()
| bool arion::FileSystemManager::has_file_entry |
( |
int |
target_fd | ) |
|
Checks whether the "files" vector contains a given file descriptor.
- Parameters
-
| [in] | target_fd | The UNIX file descriptor. |
- Returns
- True if the "files" vector contains the file descriptor.
◆ initialize()
| static std::unique_ptr< FileSystemManager > arion::FileSystemManager::initialize |
( |
std::weak_ptr< Arion > |
arion, |
|
|
std::string |
fs_path, |
|
|
std::string |
cwd_path |
|
) |
| |
|
static |
Instanciates and initializes new FileSystemManager objects with some parameters.
- Parameters
-
| [in] | arion | The Arion instance used for emulation. |
| [in] | fs_path | Path to the user specified rootfs. |
| [in] | cwd_path | Path to the user specifed current working directory. |
- Returns
- A new FileSystemManager instance.
◆ is_in_fs()
| bool arion::FileSystemManager::is_in_fs |
( |
std::string |
path | ) |
|
Checks whether the given path exists and belongs to the user specified rootfs.
- Parameters
-
- Returns
- True if the given path exists and belongs to the user specified rootfs.
◆ rm_file_entry()
| void arion::FileSystemManager::rm_file_entry |
( |
int |
target_fd | ) |
|
Removes a file entry from the "files" vector.
- Parameters
-
| [in] | target_fd | The UNIX file descriptor of the file to be removed. |
◆ set_cwd_path()
| void arion::FileSystemManager::set_cwd_path |
( |
std::string |
cwd_path | ) |
|
Defines path to the current working directory.
- Parameters
-
| [in] | cwd_path | Path to the new current working directory. |
◆ to_fs_path()
| std::string arion::FileSystemManager::to_fs_path |
( |
std::string |
path | ) |
|
Converts a given path from the emulation context into its absolute representation inside the user specified rootfs.
- Parameters
-
| [in] | path | The path to be converted. |
- Returns
- The converted path which belongs to the rootfs.
◆ arion
| std::weak_ptr<Arion> arion::FileSystemManager::arion |
|
private |
The Arion instance used for emulation.
◆ cwd_path
| std::string arion::FileSystemManager::cwd_path |
|
private |
Path to the user specifed current working directory.
◆ files
| std::map<int, std::shared_ptr<ARION_FILE> > arion::FileSystemManager::files |
A map identifying an open file given its UNIX file descriptor.
◆ fs_path
| std::string arion::FileSystemManager::fs_path |
|
private |
Path to the user specified rootfs.
◆ procfs
Used to emulate the behavior of the procfs filesystem.
The documentation for this class was generated from the following file: