aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBowgo Tsai2017-03-10 02:00:40 -0600
committerBowgo Tsai2017-03-10 03:27:31 -0600
commitd13b6cf29c71412adac3b0dca5eddcd6c75f5163 (patch)
treed31cee0706e0d942689c65cd30a0edf94c591c32 /bootloader_message/bootloader_message.cpp
parentf0e8f0727e2358d659e5c6f4b434196f2f5df8b2 (diff)
downloadplatform-bootable-recovery-d13b6cf29c71412adac3b0dca5eddcd6c75f5163.tar.gz
platform-bootable-recovery-d13b6cf29c71412adac3b0dca5eddcd6c75f5163.tar.xz
platform-bootable-recovery-d13b6cf29c71412adac3b0dca5eddcd6c75f5163.zip
recovery: replacing fs_mgr_read_fstab() with new fs_mgr APIs
The fstab settings of early-mounted partitions (e.g., /vendor) will be in kernel device tree. Switch to the new API to get the whole settings with those in device tree: fs_mgr_read_fstab_with_dt("/etc/recovery.fstab") The original default /fstab.{ro.hardware} might be moved to /vendor/etc/. or /odm/etc/. Use another new API to get the default fstab instead of using the hard-coded /fstab.{ro.hardware}. This API also includes the settings from device tree: fs_mgr_read_fstab_default() Bug: 35811655 Test: boot sailfish recovery Change-Id: Iaa56ac7f7b4c4dfc7180c65f03e9a37b94f1de09
Diffstat (limited to 'bootloader_message/bootloader_message.cpp')
-rw-r--r--bootloader_message/bootloader_message.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/bootloader_message/bootloader_message.cpp b/bootloader_message/bootloader_message.cpp
index b873d3dc..d8086be2 100644
--- a/bootloader_message/bootloader_message.cpp
+++ b/bootloader_message/bootloader_message.cpp
@@ -29,27 +29,14 @@
29#include <android-base/unique_fd.h> 29#include <android-base/unique_fd.h>
30#include <fs_mgr.h> 30#include <fs_mgr.h>
31 31
32static struct fstab* read_fstab(std::string* err) {
33 std::string ro_hardware = android::base::GetProperty("ro.hardware", "");
34 if (ro_hardware.empty()) {
35 *err = "failed to get ro.hardware";
36 return nullptr;
37 }
38 // The fstab path is always "/fstab.${ro.hardware}".
39 std::string fstab_path = "/fstab." + ro_hardware;
40 struct fstab* fstab = fs_mgr_read_fstab(fstab_path.c_str());
41 if (fstab == nullptr) {
42 *err = "failed to read " + fstab_path;
43 }
44 return fstab;
45}
46
47static std::string get_misc_blk_device(std::string* err) { 32static std::string get_misc_blk_device(std::string* err) {
48 struct fstab* fstab = read_fstab(err); 33 std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
49 if (fstab == nullptr) { 34 fs_mgr_free_fstab);
35 if (!fstab) {
36 *err = "failed to read default fstab";
50 return ""; 37 return "";
51 } 38 }
52 fstab_rec* record = fs_mgr_get_entry_for_mount_point(fstab, "/misc"); 39 fstab_rec* record = fs_mgr_get_entry_for_mount_point(fstab.get(), "/misc");
53 if (record == nullptr) { 40 if (record == nullptr) {
54 *err = "failed to find /misc partition"; 41 *err = "failed to find /misc partition";
55 return ""; 42 return "";