blob: 832a55889a2978a490de175c3d73714d2f31e88a [file] [log] [blame]
Jackeaglea3ae16b2018-12-04 11:30:49 -05001From 911e22c549e196296db3f4474d84fdec6120b2a3 Mon Sep 17 00:00:00 2001
Jon West013ef582018-08-21 20:45:26 -04002From: Pierre-Hugues Husson <phh@phh.me>
3Date: Mon, 20 Aug 2018 22:37:54 +0200
Jackeaglea3ae16b2018-12-04 11:30:49 -05004Subject: [PATCH 3/4] Support Samsung's implementation of exfat, called sdfat
Jon West013ef582018-08-21 20:45:26 -04005
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--
Jackeagled3ba2282018-11-17 20:49:22 -0700432.17.1
Jon West013ef582018-08-21 20:45:26 -040044