24#define FUSE_SUPER_MAGIC 0x65735546
40namespace fs = std::filesystem;
54 if ( statfs(path_dir_mount.c_str(), &buf) < 0 )
56 return Error(
"E::{}", strerror(errno));
59 return buf.f_type == FUSE_SUPER_MAGIC;
68inline void wait_fuse(fs::path
const& path_dir_filesystem)
70 using namespace std::chrono_literals;
71 auto time_beg = std::chrono::system_clock::now();
75 break_if(not expected_is_fuse,
"E::Could not check if filesystem is fuse");
76 break_if(*expected_is_fuse,
"D::Filesystem '{}' is fuse", path_dir_filesystem.string());
77 auto time_cur = std::chrono::system_clock::now();
78 auto elapsed = std::chrono::duration_cast<std::chrono::seconds>(time_cur - time_beg);
79 break_if(elapsed.count() > 60,
"E::Reached timeout to wait for fuse filesystems");
92 using namespace std::chrono_literals;
104 return_if(not child, Error(
"E::Could not spawn fusermount"));
107 int code = Pop(child->wait());
112 logger(
"D::Un-mounted filesystem '{}'", path_dir_mount.string());
116 logger(
"D::Failed to un-mount filesystem '{}'", path_dir_mount.string());
122 std::this_thread::sleep_for(100ms);
std::unique_ptr< Child > spawn()
Spawns (forks) the child process and begins execution.
Subprocess & with_args(Args &&... args)
Arguments forwarded as the process' arguments.
Enhanced error handling framework built on std::expected.
A library for manipulating environment variables.
#define logger(fmt,...)
Compile-time log level dispatch macro with automatic location capture.
Value< fs::path > search_path(std::string const &query)
Search the directories in the PATH variable for the given input file name.
FUSE filesystem operation utilities.
Value< int > unmount(fs::path const &path_dir_mount)
Un-mounts the given fuse mount point.
void wait_fuse(fs::path const &path_dir_filesystem)
Waits for the given directory to not be fuse.
Value< bool > is_fuse(fs::path const &path_dir_mount)
Checks if a directory is a fuse filesystem mount point.
Stream
Stream redirection modes for child process stdio.
Enhanced expected type with integrated logging capabilities.
A library to spawn sub-processes in linux.