From 7cfef55e2d91e82dcbdb73a81588b3ee9b50e629 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Wed, 12 Jul 2017 09:26:47 +0200 Subject: [PATCH] Allow a mount entry to be construct with just the mounted path --- src/anbox/common/mount_entry.cpp | 10 ++++++++++ src/anbox/common/mount_entry.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/anbox/common/mount_entry.cpp b/src/anbox/common/mount_entry.cpp index fce7831..3e9d953 100644 --- a/src/anbox/common/mount_entry.cpp +++ b/src/anbox/common/mount_entry.cpp @@ -46,6 +46,16 @@ std::shared_ptr MountEntry::create(const std::shared_ptr return entry; } +std::shared_ptr MountEntry::create(const boost::filesystem::path &target) { + auto entry = std::shared_ptr(new MountEntry(target)); + if (!entry) + return nullptr; + + entry->active_ = true; + + return entry; +} + MountEntry::MountEntry(const boost::filesystem::path &target) : active_{false}, target_{target} {} diff --git a/src/anbox/common/mount_entry.h b/src/anbox/common/mount_entry.h index 5b0be38..cc703e3 100644 --- a/src/anbox/common/mount_entry.h +++ b/src/anbox/common/mount_entry.h @@ -31,6 +31,8 @@ class MountEntry { static std::shared_ptr create(const std::shared_ptr &loop, const boost::filesystem::path &target, const std::string &fs_type = "", unsigned long flags = 0); + static std::shared_ptr create(const boost::filesystem::path &target); + ~MountEntry(); private: