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
This commit is contained in:
Bowgo Tsai 2017-03-09 22:36:34 +08:00
parent 46c6dc1a6f
commit c9a1842d31

View file

@ -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";
return;
}
std::string fstab_filename = FSTAB_PREFIX + ro_hardware;
std::unique_ptr<fstab, void(*)(fstab*)> tab(fs_mgr_read_fstab(fstab_filename.c_str()),
fs_mgr_free_fstab);
if (!tab) {
PLOG(ERROR) << "unable to read fstab " << fstab_filename;
std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
fs_mgr_free_fstab);
if (!fstab) {
PLOG(ERROR) << "unable to read default fstab";
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;