Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame^] | 1 | From dabad429ba29bd565c21bd1dde65c7e763a56238 Mon Sep 17 00:00:00 2001 |
| 2 | From: Pierre-Hugues Husson <phh@phh.me> |
| 3 | Date: Mon, 20 Aug 2018 22:37:54 +0200 |
| 4 | Subject: [PATCH 4/5] Support Samsung's implementation of exfat, called sdfat |
| 5 | |
| 6 | --- |
| 7 | fs/Exfat.cpp | 9 ++++++--- |
| 8 | 1 file changed, 6 insertions(+), 3 deletions(-) |
| 9 | |
| 10 | diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp |
| 11 | index 5c15075..5e23a79 100644 |
| 12 | --- a/fs/Exfat.cpp |
| 13 | +++ b/fs/Exfat.cpp |
| 14 | @@ -35,7 +35,7 @@ static const char* kFsckPath = "/system/bin/fsck.exfat"; |
| 15 | |
| 16 | bool IsSupported() { |
| 17 | return access(kMkfsPath, X_OK) == 0 && access(kFsckPath, X_OK) == 0 && |
| 18 | - IsFilesystemSupported("exfat"); |
| 19 | + (IsFilesystemSupported("exfat") || IsFilesystemSupported("sdfat")); |
| 20 | } |
| 21 | |
| 22 | status_t Check(const std::string& source) { |
| 23 | @@ -60,13 +60,16 @@ status_t Mount(const std::string& source, const std::string& target, int ownerUi |
| 24 | auto mountData = android::base::StringPrintf("uid=%d,gid=%d,fmask=%o,dmask=%o", ownerUid, |
| 25 | ownerGid, permMask, permMask); |
| 26 | |
| 27 | - if (mount(source.c_str(), target.c_str(), "exfat", mountFlags, mountData.c_str()) == 0) { |
| 28 | + const char *fs = "exfat"; |
| 29 | + if(IsFilesystemSupported("sdfat")) |
| 30 | + fs = "sdfat"; |
| 31 | + if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) { |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | PLOG(ERROR) << "Mount failed; attempting read-only"; |
| 36 | mountFlags |= MS_RDONLY; |
| 37 | - if (mount(source.c_str(), target.c_str(), "exfat", mountFlags, mountData.c_str()) == 0) { |
| 38 | + if (mount(source.c_str(), target.c_str(), fs, mountFlags, mountData.c_str()) == 0) { |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | -- |
| 43 | 2.7.4 |
| 44 | |