From c9a1842d319fc10681e7bb3ee66f4b365632cdf9 Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Thu, 9 Mar 2017 22:36:34 +0800 Subject: [PATCH] init: replacing fs_mgr_read_fstab() with fs_mgr_read_fstab_default() The original default /fstab.{ro.hardware} might be moved to /vendor/etc/. or /odm/etc/. Use the new API to get the default fstab instead of using the hard-coded /fstab.{ro.hardware}. Bug: 35811655 Test: boot marlin with /vendor/etc/fstab.marlin Change-Id: I8a9c70eda7f68b174ec355910d0fa1eb18a46e21 --- init/property_service.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/init/property_service.cpp b/init/property_service.cpp index d88b72e33..983e6846b 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -62,7 +62,6 @@ using android::base::StringPrintf; #define PERSISTENT_PROPERTY_DIR "/data/property" -#define FSTAB_PREFIX "/fstab." #define RECOVERY_MOUNT_POINT "/recovery" static int persistent_properties_loaded = 0; @@ -613,21 +612,14 @@ void load_persist_props(void) { } void load_recovery_id_prop() { - std::string ro_hardware = property_get("ro.hardware"); - if (ro_hardware.empty()) { - LOG(ERROR) << "ro.hardware not set - unable to load recovery id"; + std::unique_ptr fstab(fs_mgr_read_fstab_default(), + fs_mgr_free_fstab); + if (!fstab) { + PLOG(ERROR) << "unable to read default fstab"; return; } - std::string fstab_filename = FSTAB_PREFIX + ro_hardware; - std::unique_ptr tab(fs_mgr_read_fstab(fstab_filename.c_str()), - fs_mgr_free_fstab); - if (!tab) { - PLOG(ERROR) << "unable to read fstab " << fstab_filename; - return; - } - - fstab_rec* rec = fs_mgr_get_entry_for_mount_point(tab.get(), RECOVERY_MOUNT_POINT); + fstab_rec* rec = fs_mgr_get_entry_for_mount_point(fstab.get(), RECOVERY_MOUNT_POINT); if (rec == NULL) { LOG(ERROR) << "/recovery not specified in fstab"; return;