Allow a mount entry to be construct with just the mounted path

This commit is contained in:
Simon Fels 2017-07-12 09:26:47 +02:00
commit 7cfef55e2d
2 changed files with 12 additions and 0 deletions

View file

@ -46,6 +46,16 @@ std::shared_ptr<MountEntry> MountEntry::create(const std::shared_ptr<LoopDevice>
return entry;
}
std::shared_ptr<MountEntry> MountEntry::create(const boost::filesystem::path &target) {
auto entry = std::shared_ptr<MountEntry>(new MountEntry(target));
if (!entry)
return nullptr;
entry->active_ = true;
return entry;
}
MountEntry::MountEntry(const boost::filesystem::path &target) :
active_{false}, target_{target} {}

View file

@ -31,6 +31,8 @@ class MountEntry {
static std::shared_ptr<MountEntry> create(const std::shared_ptr<LoopDevice> &loop, const boost::filesystem::path &target,
const std::string &fs_type = "", unsigned long flags = 0);
static std::shared_ptr<MountEntry> create(const boost::filesystem::path &target);
~MountEntry();
private: