Merge "overlayfs: fs_mgr_overlayfs_setup() should accept Fstab as input" am: e0877535ab
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2346243 Change-Id: Idabdceb23af8d88c8cd70607d15389760860a0c4 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
ddf3f8c730
3 changed files with 11 additions and 11 deletions
|
|
@ -1351,7 +1351,8 @@ bool fs_mgr_overlayfs_mount_all(Fstab* fstab) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fs_mgr_overlayfs_setup(const char* mount_point, bool* want_reboot, bool just_disabled_verity) {
|
bool fs_mgr_overlayfs_setup(const Fstab& fstab, const char* mount_point, bool* want_reboot,
|
||||||
|
bool just_disabled_verity) {
|
||||||
if (!OverlayfsSetupAllowed(/*verbose=*/true)) {
|
if (!OverlayfsSetupAllowed(/*verbose=*/true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1361,12 +1362,6 @@ bool fs_mgr_overlayfs_setup(const char* mount_point, bool* want_reboot, bool jus
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fstab fstab;
|
|
||||||
if (!ReadDefaultFstab(&fstab)) {
|
|
||||||
LOG(ERROR) << "Could not read fstab";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto candidates = fs_mgr_overlayfs_candidate_list(fstab);
|
auto candidates = fs_mgr_overlayfs_candidate_list(fstab);
|
||||||
for (auto it = candidates.begin(); it != candidates.end();) {
|
for (auto it = candidates.begin(); it != candidates.end();) {
|
||||||
if (mount_point &&
|
if (mount_point &&
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ android::fs_mgr::Fstab fs_mgr_overlayfs_candidate_list(const android::fs_mgr::Fs
|
||||||
//
|
//
|
||||||
// If |want_reboot| is non-null, and a reboot is needed to apply overlays, then
|
// If |want_reboot| is non-null, and a reboot is needed to apply overlays, then
|
||||||
// it will be true on return. The caller is responsible for initializing it.
|
// it will be true on return. The caller is responsible for initializing it.
|
||||||
bool fs_mgr_overlayfs_setup(const char* mount_point = nullptr, bool* want_reboot = nullptr,
|
bool fs_mgr_overlayfs_setup(const android::fs_mgr::Fstab& fstab, const char* mount_point = nullptr,
|
||||||
bool just_disabled_verity = true);
|
bool* want_reboot = nullptr, bool just_disabled_verity = true);
|
||||||
|
|
||||||
enum class OverlayfsTeardownResult {
|
enum class OverlayfsTeardownResult {
|
||||||
Ok,
|
Ok,
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ bool CheckOverlayfs(Fstab* partitions, RemountCheckResult* result) {
|
||||||
if (fs_mgr_wants_overlayfs(&entry)) {
|
if (fs_mgr_wants_overlayfs(&entry)) {
|
||||||
bool want_reboot = false;
|
bool want_reboot = false;
|
||||||
bool force = result->disabled_verity;
|
bool force = result->disabled_verity;
|
||||||
if (!fs_mgr_overlayfs_setup(mount_point.c_str(), &want_reboot, force)) {
|
if (!fs_mgr_overlayfs_setup(*partitions, mount_point.c_str(), &want_reboot, force)) {
|
||||||
LOG(ERROR) << "Overlayfs setup for " << mount_point << " failed, skipping";
|
LOG(ERROR) << "Overlayfs setup for " << mount_point << " failed, skipping";
|
||||||
ok = false;
|
ok = false;
|
||||||
it = partitions->erase(it);
|
it = partitions->erase(it);
|
||||||
|
|
@ -442,7 +442,12 @@ SetVerityStateResult SetVerityState(bool enable_verity) {
|
||||||
bool SetupOrTeardownOverlayfs(bool enable) {
|
bool SetupOrTeardownOverlayfs(bool enable) {
|
||||||
bool want_reboot = false;
|
bool want_reboot = false;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
if (!fs_mgr_overlayfs_setup(nullptr, &want_reboot)) {
|
Fstab fstab;
|
||||||
|
if (!ReadDefaultFstab(&fstab)) {
|
||||||
|
LOG(ERROR) << "Could not read fstab.";
|
||||||
|
return want_reboot;
|
||||||
|
}
|
||||||
|
if (!fs_mgr_overlayfs_setup(fstab, nullptr, &want_reboot)) {
|
||||||
LOG(ERROR) << "Overlayfs setup failed.";
|
LOG(ERROR) << "Overlayfs setup failed.";
|
||||||
return want_reboot;
|
return want_reboot;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue