From 5501f733dcb54ce84eca9cb654ab47104b154b20 Mon Sep 17 00:00:00 2001 From: hmz007 Date: Wed, 15 Sep 2021 15:58:53 +0800 Subject: [PATCH] android: recovery: try to mount sdcard as exfat Signed-off-by: hmz007 --- bootable/recovery/recovery_utils/roots.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bootable/recovery/recovery_utils/roots.cpp b/bootable/recovery/recovery_utils/roots.cpp index 17e09ee89dc..390bcb982f4 100644 --- a/bootable/recovery/recovery_utils/roots.cpp +++ b/bootable/recovery/recovery_utils/roots.cpp @@ -94,8 +94,8 @@ int ensure_path_mounted(const std::string& path) { } else{ printf("ensure_path_mounted sdcard, path=%s \n", path.c_str()); - v = volume_for_mount_point(path); - if (!v) { + v = volume_for_mount_point(path); + if (!v) { printf("ensure_path_mounted No fstab entry for path=%s \n", path.c_str()); return -1; } @@ -135,17 +135,24 @@ int ensure_path_mounted(const std::string& path) { if(NULL == blk_device){ blk_device = (v->blk_device).c_str(); } - int result = mount((v->blk_device).c_str(), (v->mount_point).c_str(), (v->fs_type).c_str(), + + LOG(ERROR) << "trying mount "<< v->blk_device << " to exfat."; + int result = mount((v->blk_device).c_str(), (v->mount_point).c_str(), (char*)"exfat", + MS_NOATIME | MS_NODEV | MS_NODIRATIME, (char*)""); + if (result == 0) return 0; + + result = mount((v->blk_device).c_str(), (v->mount_point).c_str(), (v->fs_type).c_str(), MS_NOATIME | MS_NODEV | MS_NODIRATIME, (char*)"shortname=mixed,utf8"); if (result == 0) return 0; printf("v->blk_device is %s\n",(v->blk_device).c_str()); printf("v->blk_device is %s to vfat.\n",(v->blk_device).c_str()); - LOG(ERROR) << "trying mount fs"<< blk_device << " to vfat."; + LOG(ERROR) << "trying mount "<< blk_device << " to vfat."; if (blk_device !=nullptr){ result = mount(blk_device, (v->mount_point).c_str(), (v->fs_type).c_str(), MS_NOATIME | MS_NODEV | MS_NODIRATIME, (char*)"shortname=mixed,utf8"); if (result == 0) return 0; } + printf("blk_device is %s\n",blk_device); LOG(ERROR) << "trying mount "<< v->blk_device << " to ntfs."; printf("v->blk_device is %s to ntfs.\n",(v->blk_device).c_str()); @@ -168,7 +175,7 @@ int ensure_path_mounted(const std::string& path) { MS_NOATIME | MS_NODEV | MS_NODIRATIME, (char*)"shortname=mixed,utf8"); if (result == 0) return 0; - LOG(ERROR) << "tring mount " << sec_dev << " ntfs."; + LOG(ERROR) << "trying mount " << sec_dev << " ntfs."; printf("v->blk_device is %s to ntfs.\n",sec_dev); result = mount(sec_dev, (v->mount_point).c_str(), (char*)"ntfs", MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");