blob: 7b028260d7fabe62bb0f675204b722e5451fbd9b [file] [log] [blame]
Jon West013ef582018-08-21 20:45:26 -04001From dabad429ba29bd565c21bd1dde65c7e763a56238 Mon Sep 17 00:00:00 2001
2From: Pierre-Hugues Husson <phh@phh.me>
3Date: Mon, 20 Aug 2018 22:37:54 +0200
4Subject: [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
10diff --git a/fs/Exfat.cpp b/fs/Exfat.cpp
11index 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--
432.7.4
44