summaryrefslogtreecommitdiffstats
path: root/health
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2019-01-30 12:39:51 -0800
committerTom Cherry <tomcherry@google.com>2019-01-30 14:27:43 -0800
commitbf94481483be1cf8b9bb5d9bbd99e75b414c6f90 (patch)
treef792b20567da3136334735b3d48c168c3de7a268 /health
parent29471a8935101fd8c4c9d84944cb6aeb54c02228 (diff)
downloadandroid_hardware_interfaces-bf94481483be1cf8b9bb5d9bbd99e75b414c6f90.tar.gz
android_hardware_interfaces-bf94481483be1cf8b9bb5d9bbd99e75b414c6f90.tar.bz2
android_hardware_interfaces-bf94481483be1cf8b9bb5d9bbd99e75b414c6f90.zip
Move to new Fstab class
Test: treehugger Change-Id: I0a3a58193c1482296bc5b60df3f9247e5f1366c3
Diffstat (limited to 'health')
-rw-r--r--health/storage/1.0/default/Storage.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/health/storage/1.0/default/Storage.cpp b/health/storage/1.0/default/Storage.cpp
index 2e53c5089..561deaaed 100644
--- a/health/storage/1.0/default/Storage.cpp
+++ b/health/storage/1.0/default/Storage.cpp
@@ -36,27 +36,20 @@ using base::Timer;
using base::Trim;
using base::WriteStringToFd;
using base::WriteStringToFile;
+using fs_mgr::Fstab;
+using fs_mgr::ReadDefaultFstab;
std::string getGarbageCollectPath() {
- std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
- fs_mgr_free_fstab);
- struct fstab_rec* rec = NULL;
-
- for (int i = 0; i < fstab->num_entries; i++) {
- if (fs_mgr_has_sysfs_path(&fstab->recs[i])) {
- rec = &fstab->recs[i];
- break;
+ Fstab fstab;
+ ReadDefaultFstab(&fstab);
+
+ for (const auto& entry : fstab) {
+ if (!entry.sysfs_path.empty()) {
+ return entry.sysfs_path + "/manual_gc";
}
}
- if (!rec) {
- return "";
- }
-
- std::string path;
- path.append(rec->sysfs_path);
- path = path + "/manual_gc";
- return path;
+ return "";
}
Return<void> Storage::garbageCollect(uint64_t timeoutSeconds,