fs_mgr: Add fs_mgr_overlayfs_required_devices()

Added fs_mgr_overlayfs_required_devices() as hint to init to make sure
the device gets created before fs_mgr_overlayfs_mount_all().

Test: manual
Bug: 109821005
Change-Id: Iab038f3e0252a357b082bb08db3679512b9badec
This commit is contained in:
Mark Salyzyn 2018-08-29 10:44:33 -07:00
parent 29553d2d52
commit e511e3a3b1
3 changed files with 16 additions and 0 deletions

View file

@ -53,6 +53,10 @@ bool fs_mgr_overlayfs_mount_all(const fstab*) {
return false;
}
std::vector<std::string> fs_mgr_overlayfs_required_devices(const fstab*) {
return {};
}
bool fs_mgr_overlayfs_setup(const char*, const char*, bool* change) {
if (change) *change = false;
return false;
@ -467,6 +471,10 @@ bool fs_mgr_overlayfs_mount_all(const fstab* fstab) {
return ret;
}
std::vector<std::string> fs_mgr_overlayfs_required_devices(const fstab*) {
return {};
}
// Returns false if setup not permitted, errno set to last error.
// If something is altered, set *change.
bool fs_mgr_overlayfs_setup(const char* backing, const char* mount_point, bool* change) {

View file

@ -19,8 +19,10 @@
#include <fstab/fstab.h>
#include <string>
#include <vector>
bool fs_mgr_overlayfs_mount_all(const fstab* fstab);
std::vector<std::string> fs_mgr_overlayfs_required_devices(const fstab* fstab);
bool fs_mgr_overlayfs_setup(const char* backing = nullptr, const char* mount_point = nullptr,
bool* change = nullptr);
bool fs_mgr_overlayfs_teardown(const char* mount_point = nullptr, bool* change = nullptr);

View file

@ -391,6 +391,12 @@ bool FirstStageMount::MountPartitions() {
}
}
// heads up for instantiating required device(s) for overlayfs logic
const auto devices = fs_mgr_overlayfs_required_devices(device_tree_fstab_.get());
for (auto const& device : devices) {
InitMappedDevice(device);
}
fs_mgr_overlayfs_mount_all(device_tree_fstab_.get());
return true;