|
FlatImage
A configurable Linux containerization system
|
Filesystem utility functions. More...
Classes | |
| struct | Instance |
| Represents an instance. More... | |
Functions | |
| bool | is_busy (fs::path const &path_dir) |
| Checks if a filesystem path is currently in use by any active process. | |
| Value< void > | wait_busy (fs::path const &path_dir, std::chrono::nanoseconds timeout) |
| Waits for a filesystem path to become available (not busy). | |
| std::vector< Instance > | get_instances (fs::path const &path_dir_instances) |
| Get the running FlatImage instances. | |
| std::vector< fs::path > | get_mounted_layers (fs::path const &path_dir_layers) |
| Get a path for each layer directory. | |
Filesystem utility functions.
Provides utility functions for filesystem management including busy state detection by scanning /proc/[pid]/mountinfo, layer enumeration, and instance cleanup operations. Supports filesystem state queries and validation for safe mount/unmount operations.
|
inlinenodiscard |
Get the running FlatImage instances.
Enumerates all active FlatImage instances by scanning the instance directory. Each subdirectory in path_dir_instances is expected to be named after a process ID (PID).
| path_dir_instances | Path to FIM_DIR_INSTANCE of a FlatImage application |
Definition at line 137 of file utils.hpp.
|
inlinenodiscard |
Get a path for each layer directory.
Each entry in path_dir_layers is expected to be a directory representing a filesystem layer. The function filters and collects only valid directories, excluding any files or invalid entries.
| path_dir_layers | Path to the layer directory |
Definition at line 164 of file utils.hpp.
|
inline |
Checks if a filesystem path is currently in use by any active process.
Scans all processes in /proc/[pid]/mountinfo to determine if the given path is mounted or actively used. Iterates through each process's mount information and returns true if the path is found in any mountinfo entry, indicating the path is busy/in-use.
| path_dir | The filesystem path to check for busy status. |
Definition at line 50 of file utils.hpp.
|
inlinenodiscard |
Waits for a filesystem path to become available (not busy).
Polls the is_busy() function at 100ms intervals until either the path becomes available or the timeout is reached. Uses chrono duration for precise time tracking.
| path_dir | The filesystem path to monitor for busy status. |
| timeout | Maximum time to wait before timing out (accepts any chrono duration type). |
Definition at line 92 of file utils.hpp.