}
if (mFsType == "ext4") {
- int res = ext4::Check(mDmDevPath, mPath);
+ int res = ext4::Check(mDmDevPath, mPath, true);
if (res == 0 || res == 1) {
LOG(DEBUG) << getId() << " passed filesystem check";
} else {
}
} else if (mFsType == "f2fs") {
- int res = f2fs::Check(mDmDevPath);
+ int res = f2fs::Check(mDmDevPath, true);
if (res == 0) {
LOG(DEBUG) << getId() << " passed filesystem check";
} else {
if (mFsType == "exfat") {
ret = exfat::Check(mDevPath);
} else if (mFsType == "ext4") {
- ret = ext4::Check(mDevPath, mRawPath);
+ ret = ext4::Check(mDevPath, mRawPath, false);
} else if (mFsType == "f2fs") {
- ret = f2fs::Check(mDevPath);
+ ret = f2fs::Check(mDevPath, false);
} else if (mFsType == "ntfs") {
ret = ntfs::Check(mDevPath);
} else if (mFsType == "vfat") {
cmd.push_back(kFsckPath);
cmd.push_back(source);
- return ForkExecvp(cmd, sFsckContext);
+ // Exfat devices are currently always untrusted
+ return ForkExecvp(cmd, sFsckUntrustedContext);
}
status_t Mount(const std::string& source, const std::string& target, bool ro,
&& IsFilesystemSupported("ext4");
}
-status_t Check(const std::string& source, const std::string& target) {
+status_t Check(const std::string& source, const std::string& target, bool trusted) {
// The following is shamelessly borrowed from fs_mgr.c, so it should be
// kept in sync with any changes over there.
cmd.push_back("-y");
cmd.push_back(c_source);
- // ext4 devices are currently always trusted
- return ForkExecvp(cmd, sFsckContext);
+ return ForkExecvp(cmd, trusted ? sFsckContext : sFsckUntrustedContext);
}
return 0;
bool IsSupported();
-status_t Check(const std::string& source, const std::string& target);
+status_t Check(const std::string& source, const std::string& target, bool trusted);
status_t Mount(const std::string& source, const std::string& target, bool ro,
bool remount, bool executable, const std::string& opts = "");
status_t Format(const std::string& source, unsigned int numSectors,
&& IsFilesystemSupported("f2fs");
}
-status_t Check(const std::string& source) {
+status_t Check(const std::string& source, bool trusted) {
std::vector<std::string> cmd;
cmd.push_back(kFsckPath);
cmd.push_back("-a");
cmd.push_back(source);
- // f2fs devices are currently always trusted
- return ForkExecvp(cmd, sFsckContext);
+ return ForkExecvp(cmd, trusted ? sFsckContext : sFsckUntrustedContext);
}
status_t Mount(const std::string& source, const std::string& target) {
bool IsSupported();
-status_t Check(const std::string& source);
+status_t Check(const std::string& source, bool trusted);
status_t Mount(const std::string& source, const std::string& target);
status_t Format(const std::string& source);
cmd.push_back("-n");
cmd.push_back(source);
- return ForkExecvp(cmd, sFsckContext);
+ // Ntfs devices are currently always untrusted
+ return ForkExecvp(cmd, sFsckUntrustedContext);
}
status_t Mount(const std::string& source, const std::string& target, bool ro,