summaryrefslogtreecommitdiff
path: root/services/incremental/IncrementalService.cpp
diff options
context:
space:
mode:
authorAlex Buynytskyy <alexbuy@google.com>2020-04-02 00:36:26 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-04-02 00:36:26 +0000
commit50e0244012bf627d015ed04fab224609258870eb (patch)
tree251588009923ee31a3a42444adb365850b9ac8aa /services/incremental/IncrementalService.cpp
parenta957475923108063af3ec244042df20b74cbb4f3 (diff)
parent5e860ba10563f092110cfd708d8b310372c4df3c (diff)
Merge changes from topic "LOADER_USAGE_STATS" into rvc-dev
* changes: Checking LOADER_USAGE_STATS before enabling read logs. Revert "Update the current API dump"
Diffstat (limited to 'services/incremental/IncrementalService.cpp')
-rw-r--r--services/incremental/IncrementalService.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp
index cae411b1d84f..5e3c337da11e 100644
--- a/services/incremental/IncrementalService.cpp
+++ b/services/incremental/IncrementalService.cpp
@@ -563,6 +563,36 @@ StorageId IncrementalService::findStorageId(std::string_view path) const {
return it->second->second.storage;
}
+int IncrementalService::setStorageParams(StorageId storageId, bool enableReadLogs) {
+ const auto ifs = getIfs(storageId);
+ if (!ifs) {
+ return -EINVAL;
+ }
+
+ using unique_fd = ::android::base::unique_fd;
+ ::android::os::incremental::IncrementalFileSystemControlParcel control;
+ control.cmd.reset(unique_fd(dup(ifs->control.cmd())));
+ control.pendingReads.reset(unique_fd(dup(ifs->control.pendingReads())));
+ auto logsFd = ifs->control.logs();
+ if (logsFd >= 0) {
+ control.log.reset(unique_fd(dup(logsFd)));
+ }
+
+ std::lock_guard l(mMountOperationLock);
+ const auto status = mVold->setIncFsMountOptions(control, enableReadLogs);
+ if (!status.isOk()) {
+ LOG(ERROR) << "Calling Vold::setIncFsMountOptions() failed: " << status.toString8();
+ return status.exceptionCode() == binder::Status::EX_SERVICE_SPECIFIC
+ ? status.serviceSpecificErrorCode() > 0 ? -status.serviceSpecificErrorCode()
+ : status.serviceSpecificErrorCode() == 0
+ ? -EFAULT
+ : status.serviceSpecificErrorCode()
+ : -EIO;
+ }
+
+ return 0;
+}
+
void IncrementalService::deleteStorage(StorageId storageId) {
const auto ifs = getIfs(storageId);
if (!ifs) {
@@ -737,10 +767,12 @@ int IncrementalService::makeFile(StorageId storage, std::string_view path, int m
if (auto ifs = getIfs(storage)) {
std::string normPath = normalizePathToStorage(ifs, storage, path);
if (normPath.empty()) {
+ LOG(ERROR) << "Internal error: storageId " << storage << " failed to normalize: " << path;
return -EINVAL;
}
auto err = mIncFs->makeFile(ifs->control, normPath, mode, id, params);
if (err) {
+ LOG(ERROR) << "Internal error: storageId " << storage << " failed to makeFile: " << err;
return err;
}
std::vector<uint8_t> metadataBytes;