Merge changes Idc575106,Id6457a2b
* changes:
IdleMaint: skip swap space, bind mounts, and virtual filesystems
IdleMaint: use fstab_default from VoldUtil
diff --git a/Checkpoint.cpp b/Checkpoint.cpp
index 61035e5..755f0e3 100644
--- a/Checkpoint.cpp
+++ b/Checkpoint.cpp
@@ -47,7 +47,6 @@
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;
diff --git a/IdleMaint.cpp b/IdleMaint.cpp
index 2b5a8f1..e4a1806 100644
--- a/IdleMaint.cpp
+++ b/IdleMaint.cpp
@@ -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::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,17 +103,18 @@
}
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) {
- // Skip raw partitions.
- if (entry.fs_type == "emmc" || entry.fs_type == "mtd") {
+ for (const auto& entry : fstab_default) {
+ // Skip raw partitions and swap space.
+ if (entry.fs_type == "emmc" || entry.fs_type == "mtd" || entry.fs_type == "swap") {
continue;
}
- // Skip read-only filesystems
- if (entry.flags & MS_RDONLY) {
+ // Skip read-only filesystems and bind mounts.
+ if (entry.flags & (MS_RDONLY | MS_BIND)) {
+ continue;
+ }
+ // Skip anything without an underlying block device, e.g. virtiofs.
+ if (entry.blk_device[0] != '/') {
continue;
}
if (entry.fs_mgr_flags.vold_managed) {
@@ -253,11 +253,8 @@
}
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;