Jackeagle | a3ae16b | 2018-12-04 11:30:49 -0500 | [diff] [blame^] | 1 | From 911e22c549e196296db3f4474d84fdec6120b2a3 Mon Sep 17 00:00:00 2001 |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 2 | From: Pierre-Hugues Husson <phh@phh.me> |
| 3 | Date: Mon, 20 Aug 2018 22:37:54 +0200 |
Jackeagle | a3ae16b | 2018-12-04 11:30:49 -0500 | [diff] [blame^] | 4 | Subject: [PATCH 3/4] Support Samsung's implementation of exfat, called sdfat |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 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 | -- |
Jackeagle | d3ba228 | 2018-11-17 20:49:22 -0700 | [diff] [blame] | 43 | 2.17.1 |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 44 | |