fs_mgr: Refactor fs_mgr_overlayfs_already_mounted() to be more readable
Bug: 293695109 Test: adb_remount test Change-Id: Idadd5b99e48fa601b1046aef533027ea6ba5c2f6
This commit is contained in:
parent
244e581a31
commit
37467f3665
1 changed files with 9 additions and 6 deletions
|
|
@ -733,15 +733,18 @@ bool fs_mgr_overlayfs_is_setup() {
|
|||
|
||||
bool fs_mgr_overlayfs_already_mounted(const std::string& mount_point, bool overlay_only) {
|
||||
Fstab fstab;
|
||||
if (!ReadFstabFromFile("/proc/mounts", &fstab)) {
|
||||
if (!ReadFstabFromProcMounts(&fstab)) {
|
||||
return false;
|
||||
}
|
||||
const auto lowerdir = kLowerdirOption + mount_point;
|
||||
for (const auto& entry : fstab) {
|
||||
if (overlay_only && "overlay" != entry.fs_type && "overlayfs" != entry.fs_type) continue;
|
||||
if (mount_point != entry.mount_point) continue;
|
||||
if (!overlay_only) return true;
|
||||
const auto options = android::base::Split(entry.fs_options, ",");
|
||||
for (const auto& entry : GetEntriesForMountPoint(&fstab, mount_point)) {
|
||||
if (!overlay_only) {
|
||||
return true;
|
||||
}
|
||||
if (entry->fs_type != "overlay" && entry->fs_type != "overlayfs") {
|
||||
continue;
|
||||
}
|
||||
const auto options = android::base::Split(entry->fs_options, ",");
|
||||
for (const auto& opt : options) {
|
||||
if (opt == lowerdir) {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue