Add support for casefolding and project quotas
This enables ext4 casefolding and project quotas for adopted storage cards. Test: Enable virtual sdcard, adopt, check options on formatted disk Bug: 138321217 Bug: 138322712 Change-Id: I99c09283cd78c30237cf18ad9ae9384ba0c05396
This commit is contained in:
parent
f9510e3262
commit
477f3e5f4a
1 changed files with 19 additions and 0 deletions
19
fs/Ext4.cpp
19
fs/Ext4.cpp
|
@ -171,6 +171,14 @@ status_t Format(const std::string& source, unsigned long numSectors, const std::
|
||||||
cmd.push_back("-M");
|
cmd.push_back("-M");
|
||||||
cmd.push_back(target);
|
cmd.push_back(target);
|
||||||
|
|
||||||
|
bool needs_casefold = android::base::GetBoolProperty("ro.emulated_storage.casefold", false);
|
||||||
|
bool needs_projid = android::base::GetBoolProperty("ro.emulated_storage.projid", false);
|
||||||
|
|
||||||
|
if (needs_projid) {
|
||||||
|
cmd.push_back("-I");
|
||||||
|
cmd.push_back("512");
|
||||||
|
}
|
||||||
|
|
||||||
std::string options("has_journal");
|
std::string options("has_journal");
|
||||||
if (android::base::GetBoolProperty("vold.has_quota", false)) {
|
if (android::base::GetBoolProperty("vold.has_quota", false)) {
|
||||||
options += ",quota";
|
options += ",quota";
|
||||||
|
@ -178,10 +186,21 @@ status_t Format(const std::string& source, unsigned long numSectors, const std::
|
||||||
if (fscrypt_is_native()) {
|
if (fscrypt_is_native()) {
|
||||||
options += ",encrypt";
|
options += ",encrypt";
|
||||||
}
|
}
|
||||||
|
if (needs_casefold) {
|
||||||
|
options += ",casefold";
|
||||||
|
}
|
||||||
|
|
||||||
cmd.push_back("-O");
|
cmd.push_back("-O");
|
||||||
cmd.push_back(options);
|
cmd.push_back(options);
|
||||||
|
|
||||||
|
if (needs_casefold || needs_projid) {
|
||||||
|
cmd.push_back("-E");
|
||||||
|
std::string extopts = "";
|
||||||
|
if (needs_casefold) extopts += "encoding=utf8,";
|
||||||
|
if (needs_projid) extopts += "quotatype=prjquota,";
|
||||||
|
cmd.push_back(extopts);
|
||||||
|
}
|
||||||
|
|
||||||
cmd.push_back(source);
|
cmd.push_back(source);
|
||||||
|
|
||||||
if (numSectors) {
|
if (numSectors) {
|
||||||
|
|
Loading…
Reference in a new issue