OSDN Git Service

IdleMaint: use fstab_default from VoldUtil
authorEric Biggers <ebiggers@google.com>
Thu, 15 Oct 2020 23:54:38 +0000 (16:54 -0700)
committerEric Biggers <ebiggers@google.com>
Thu, 15 Oct 2020 23:54:38 +0000 (16:54 -0700)
vold already reads the default fstab into memory when starting up, and
the default fstab isn't allowed to change later.  So in IdleMaint.cpp,
just use 'fstab_default' instead of reading it again.

This also has the advantage that fstab entries for "logical partitions"
now get a properly updated blk_device, which is needed in order to start
using blk_device to exclude virtual filesystems in addFromFstab().

Change-Id: Id6457a2b7972d01dde4bca0c5f2da86374d930af

Checkpoint.cpp
IdleMaint.cpp

index 61035e5..755f0e3 100644 (file)
@@ -47,7 +47,6 @@ using android::base::GetUintProperty;
 using android::base::SetProperty;
 using android::binder::Status;
 using android::fs_mgr::Fstab;
-using android::fs_mgr::ReadDefaultFstab;
 using android::fs_mgr::ReadFstabFromFile;
 using android::hardware::hidl_string;
 using android::hardware::boot::V1_0::BoolResult;
index 2b5a8f1..24a1ef9 100644 (file)
@@ -17,6 +17,7 @@
 #include "IdleMaint.h"
 #include "FileDeviceUtils.h"
 #include "Utils.h"
+#include "VoldUtil.h"
 #include "VolumeManager.h"
 #include "model/PrivateVolume.h"
 
@@ -45,8 +46,6 @@ using android::base::Realpath;
 using android::base::StringPrintf;
 using android::base::Timer;
 using android::base::WriteStringToFile;
-using android::fs_mgr::Fstab;
-using android::fs_mgr::ReadDefaultFstab;
 using android::hardware::Return;
 using android::hardware::Void;
 using android::hardware::health::storage::V1_0::IStorage;
@@ -104,11 +103,8 @@ static void addFromVolumeManager(std::list<std::string>* paths, PathTypes path_t
 }
 
 static void addFromFstab(std::list<std::string>* paths, PathTypes path_type) {
-    Fstab fstab;
-    ReadDefaultFstab(&fstab);
-
     std::string previous_mount_point;
-    for (const auto& entry : fstab) {
+    for (const auto& entry : fstab_default) {
         // Skip raw partitions.
         if (entry.fs_type == "emmc" || entry.fs_type == "mtd") {
             continue;
@@ -253,11 +249,8 @@ static int stopGc(const std::list<std::string>& paths) {
 }
 
 static void runDevGcFstab(void) {
-    Fstab fstab;
-    ReadDefaultFstab(&fstab);
-
     std::string path;
-    for (const auto& entry : fstab) {
+    for (const auto& entry : fstab_default) {
         if (!entry.sysfs_path.empty()) {
             path = entry.sysfs_path;
             break;