fs_mgr: overlayfs takes const std::vector<const fstab_rec*>&
fs_mgr_overlayfs_mount_all() and fs_mgr_overlayfs_required_devices()
to also take const std::vector<const fstab_rec*>& argument.
Bug: 117933812
Test: manual adb-remount-test.sh
Change-Id: Ic72fcca1fe32c311ff3f903c7275e6f7dfba46a7
diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp
index 79957f6..2ac638a 100644
--- a/fs_mgr/fs_mgr_overlayfs.cpp
+++ b/fs_mgr/fs_mgr_overlayfs.cpp
@@ -61,10 +61,18 @@
return false;
}
+bool fs_mgr_overlayfs_mount_all(const std::vector<const fstab_rec*>&) {
+ return false;
+}
+
std::vector<std::string> fs_mgr_overlayfs_required_devices(fstab*) {
return {};
}
+std::vector<std::string> fs_mgr_overlayfs_required_devices(const std::vector<const fstab_rec*>&) {
+ return {};
+}
+
bool fs_mgr_overlayfs_setup(const char*, const char*, bool* change) {
if (change) *change = false;
return false;
@@ -764,6 +772,13 @@
return ret;
}
+bool fs_mgr_overlayfs_mount_all(const std::vector<const fstab_rec*>& fsrecs) {
+ std::vector<fstab_rec> recs;
+ for (const auto& rec : fsrecs) recs.push_back(*rec);
+ fstab fstab = {static_cast<int>(fsrecs.size()), &recs[0]};
+ return fs_mgr_overlayfs_mount_all(&fstab);
+}
+
std::vector<std::string> fs_mgr_overlayfs_required_devices(fstab* fstab) {
if (fs_mgr_get_entry_for_mount_point(const_cast<struct fstab*>(fstab), kScratchMountPoint)) {
return {};
@@ -778,6 +793,14 @@
return {};
}
+std::vector<std::string> fs_mgr_overlayfs_required_devices(
+ const std::vector<const fstab_rec*>& fsrecs) {
+ std::vector<fstab_rec> recs;
+ for (const auto& rec : fsrecs) recs.push_back(*rec);
+ fstab fstab = {static_cast<int>(fsrecs.size()), &recs[0]};
+ return fs_mgr_overlayfs_required_devices(&fstab);
+}
+
// 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) {
diff --git a/fs_mgr/include/fs_mgr_overlayfs.h b/fs_mgr/include/fs_mgr_overlayfs.h
index 550dd18..9182532 100644
--- a/fs_mgr/include/fs_mgr_overlayfs.h
+++ b/fs_mgr/include/fs_mgr_overlayfs.h
@@ -22,7 +22,10 @@
#include <vector>
bool fs_mgr_overlayfs_mount_all(fstab* fstab);
+bool fs_mgr_overlayfs_mount_all(const std::vector<const fstab_rec*>& fstab);
std::vector<std::string> fs_mgr_overlayfs_required_devices(fstab* fstab);
+std::vector<std::string> fs_mgr_overlayfs_required_devices(
+ const std::vector<const fstab_rec*>& 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);