Fully switch to mke2fs; set policies everywhere.
Older make_ext4fs doesn't support enabling quotas, so switch everyone
over to using mke2fs for adoptable storage.
Remove UUID check so that we start setting ext4-crypto policies on
adoptable storage devices; a future change will handle the actual
key management.
Bug: 30230655, 36757864
Test: cts-tradefed run commandAndExit cts-dev --abi armeabi-v7a -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Change-Id: I021f85b1be8431044c239521c37be96534682746
diff --git a/fs/Ext4.cpp b/fs/Ext4.cpp
index 041ce90..adb8f2e 100644
--- a/fs/Ext4.cpp
+++ b/fs/Ext4.cpp
@@ -56,11 +56,7 @@
namespace ext4 {
static const char* kResizefsPath = "/system/bin/resize2fs";
-#ifdef TARGET_USES_MKE2FS
static const char* kMkfsPath = "/system/bin/mke2fs";
-#else
-static const char* kMkfsPath = "/system/bin/make_ext4fs";
-#endif
static const char* kFsckPath = "/system/bin/e2fsck";
bool IsSupported() {
@@ -171,7 +167,6 @@
std::vector<std::string> cmd;
cmd.push_back(kMkfsPath);
-#ifdef TARGET_USES_MKE2FS
cmd.push_back("-b");
cmd.push_back("4096");
@@ -191,24 +186,10 @@
cmd.push_back(source);
- if (numSectors)
- cmd.push_back(StringPrintf("%lu", numSectors * (4096 / 512)));
-#else
- cmd.push_back("-J");
-
- cmd.push_back("-a");
- cmd.push_back(target);
-
if (numSectors) {
- cmd.push_back("-l");
- cmd.push_back(StringPrintf("%lu", numSectors * 512));
+ cmd.push_back(StringPrintf("%lu", numSectors * (4096 / 512)));
}
- // Always generate a real UUID
- cmd.push_back("-u");
- cmd.push_back(source);
-#endif
-
return ForkExecvp(cmd);
}