diff --git a/src/anbox/common/mount_entry.cpp b/src/anbox/common/mount_entry.cpp index 3e9d953..675778d 100644 --- a/src/anbox/common/mount_entry.cpp +++ b/src/anbox/common/mount_entry.cpp @@ -17,18 +17,23 @@ #include "anbox/common/mount_entry.h" #include "anbox/common/loop_device.h" +#include "anbox/logger.h" #include namespace anbox { namespace common { std::shared_ptr MountEntry::create(const boost::filesystem::path &src, const boost::filesystem::path &target, - const std::string &fs_type, unsigned long flags) { + const std::string &fs_type, unsigned long flags, const std::string &data) { auto entry = std::shared_ptr(new MountEntry(target)); if (!entry) return nullptr; - if (::mount(src.c_str(), target.c_str(), !fs_type.empty() ? fs_type.c_str() : nullptr, flags, nullptr) != 0) + const void *mount_data = nullptr; + if (!data.empty()) + mount_data = reinterpret_cast(data.c_str()); + + if (::mount(src.c_str(), target.c_str(), !fs_type.empty() ? fs_type.c_str() : nullptr, flags, mount_data) != 0) return nullptr; entry->active_ = true; @@ -37,8 +42,8 @@ std::shared_ptr MountEntry::create(const boost::filesystem::path &sr } std::shared_ptr MountEntry::create(const std::shared_ptr &loop, const boost::filesystem::path &target, - const std::string &fs_type, unsigned long flags) { - auto entry = create(loop->path(), target, fs_type, flags); + const std::string &fs_type, unsigned long flags, const std::string &data) { + auto entry = create(loop->path(), target, fs_type, flags, data); if (!entry) return nullptr; diff --git a/src/anbox/common/mount_entry.h b/src/anbox/common/mount_entry.h index cc703e3..2ea95f9 100644 --- a/src/anbox/common/mount_entry.h +++ b/src/anbox/common/mount_entry.h @@ -26,10 +26,10 @@ class LoopDevice; class MountEntry { public: static std::shared_ptr create(const boost::filesystem::path &src, const boost::filesystem::path &target, - const std::string &fs_type = "", unsigned long flags = 0); + const std::string &fs_type = "", unsigned long flags = 0, const std::string &data = ""); static std::shared_ptr create(const std::shared_ptr &loop, const boost::filesystem::path &target, - const std::string &fs_type = "", unsigned long flags = 0); + const std::string &fs_type = "", unsigned long flags = 0, const std::string &data = ""); static std::shared_ptr create(const boost::filesystem::path &target);