From 66ee277353c7e372ce5ad8a87d5591600fe284dd Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Fri, 10 Mar 2017 16:43:02 +0800 Subject: [PATCH] adb: 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, then run 'adb remount' Change-Id: I927209ce3c5bea45c01ed631a7c4c320fe728c00 --- adb/remount_service.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/adb/remount_service.cpp b/adb/remount_service.cpp index 5ca73cc27..32ed28f59 100644 --- a/adb/remount_service.cpp +++ b/adb/remount_service.cpp @@ -54,12 +54,10 @@ static std::string find_proc_mount(const char* dir) { // Returns the device used to mount a directory in the fstab. static std::string find_fstab_mount(const char* dir) { - std::string fstab_filename = "/fstab." + android::base::GetProperty("ro.hardware", ""); - struct fstab* fstab = fs_mgr_read_fstab(fstab_filename.c_str()); - struct fstab_rec* rec = fs_mgr_get_entry_for_mount_point(fstab, dir); - std::string dev = rec ? std::string(rec->blk_device) : ""; - fs_mgr_free_fstab(fstab); - return dev; + std::unique_ptr fstab(fs_mgr_read_fstab_default(), + fs_mgr_free_fstab); + struct fstab_rec* rec = fs_mgr_get_entry_for_mount_point(fstab.get(), dir); + return rec ? rec->blk_device : ""; } // The proc entry for / is full of lies, so check fstab instead.