summaryrefslogtreecommitdiff
path: root/bootloader_message
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2018-12-04 09:37:39 -0800
committerTom Cherry <tomcherry@google.com>2018-12-04 11:11:14 -0800
commit772c93ca5c98f21b766fcf2fbf25c8ebf742e2fb (patch)
treef6856d3373d2a46217e191eecae405fd2fd0d188 /bootloader_message
parent8fc15c02bdf1f5894b0a88f948ae677912426139 (diff)
Move some small users of fstab to new C++ Fstab
Bug: 62292478 Test: tree-hugger Change-Id: Ie2cc10e5168ef3b9dcc42f88e67a1ccd1175fcc5
Diffstat (limited to 'bootloader_message')
-rw-r--r--bootloader_message/bootloader_message.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/bootloader_message/bootloader_message.cpp b/bootloader_message/bootloader_message.cpp
index aaeffdc5..b933cbf8 100644
--- a/bootloader_message/bootloader_message.cpp
+++ b/bootloader_message/bootloader_message.cpp
@@ -27,21 +27,22 @@
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
-#include <fs_mgr.h>
+#include <fstab/fstab.h>
static std::string get_misc_blk_device(std::string* err) {
- std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
- fs_mgr_free_fstab);
- if (!fstab) {
+ Fstab fstab;
+ if (!ReadDefaultFstab(&fstab)) {
*err = "failed to read default fstab";
return "";
}
- fstab_rec* record = fs_mgr_get_entry_for_mount_point(fstab.get(), "/misc");
- if (record == nullptr) {
- *err = "failed to find /misc partition";
- return "";
+ for (const auto& entry : fstab) {
+ if (entry.mount_point == "/misc") {
+ return entry.blk_device;
+ }
}
- return record->blk_device;
+
+ *err = "failed to find /misc partition";
+ return "";
}
// In recovery mode, recovery can get started and try to access the misc