namespace fs = std::filesystem;
struct DirBackend {
- virtual void RemoveSubsession (const std::filesystem::path& subsession_path) const = 0;
- virtual void SwitchSubsessionAway (const std::filesystem::path& subsession_path) const = 0;
- virtual void SwitchSubsessionInto (const std::filesystem::path& subsession_path) const = 0;
+ virtual void RemoveSubsession (const fs::path& subsession_path) const = 0;
+ virtual void SwitchSubsessionAway (const fs::path& subsession_path) const = 0;
+ virtual void SwitchSubsessionInto (const fs::path& subsession_path) const = 0;
};
struct DirBackendAdd {
#include <string_view>
-namespace fs = std::filesystem;
using namespace std::literals;
// Should be unique per-backend.
fs::remove(image_path);
}
-void DirBackendFixedSize::SwitchSubsessionAway (const std::filesystem::path& subsession_path) const
+void DirBackendFixedSize::SwitchSubsessionAway (const fs::path& subsession_path) const
{
/* Note, we cannot keep the subsession mounted permanently,
* from Add until Remove, because reboots happen. */
do_umount(subsession_path);
}
-void DirBackendFixedSize::SwitchSubsessionInto (const std::filesystem::path& subsession_path) const
+void DirBackendFixedSize::SwitchSubsessionInto (const fs::path& subsession_path) const
{
const auto image_path = GetImagePathFromSubsessionPath(subsession_path);
#include <cstdint>
-namespace fs = std::filesystem;
-
struct DirBackendFixedSize : public DirBackend {
void RemoveSubsession (const fs::path& subsession_path) const override;
void SwitchSubsessionAway (const fs::path& subsession_path) const override;
#include "dir_backend_regular_dir.hpp"
#include "os_ops.hpp"
-namespace fs = std::filesystem;
using namespace std::string_literals;
fs::path DirBackendAddRegularDir::AddSubsessionPrepare (const fs::path& subsession_path, int uid, int gid) const
fs::remove_all(tmp_subsession_path);
}
-void DirBackendRegularDir::SwitchSubsessionAway (const std::filesystem::path& subsession_path) const
+void DirBackendRegularDir::SwitchSubsessionAway (const fs::path& subsession_path) const
{
}
-void DirBackendRegularDir::SwitchSubsessionInto (const std::filesystem::path& subsession_path) const
+void DirBackendRegularDir::SwitchSubsessionInto (const fs::path& subsession_path) const
{
}
#include "dir_backend.hpp"
struct DirBackendRegularDir : public DirBackend {
- void RemoveSubsession (const std::filesystem::path& subsession_path) const override;
- void SwitchSubsessionAway (const std::filesystem::path& subsession_path) const override;
- void SwitchSubsessionInto (const std::filesystem::path& subsession_path) const override;
+ void RemoveSubsession (const fs::path& subsession_path) const override;
+ void SwitchSubsessionAway (const fs::path& subsession_path) const override;
+ void SwitchSubsessionInto (const fs::path& subsession_path) const override;
};
struct DirBackendAddRegularDir : public DirBackendAdd {
}
// Create `$HOME/subsession` directory if it doesn't exist
-static void create_main_subdirectory(const int session_uid, fs::path main_dir)
+static void create_main_subdirectory(const int session_uid, const fs::path& main_dir)
{
if (fs::exists(main_dir))
return;