Expose new IncFS interface through Vold
CL is a part of multi-repository topic and will be merged
to AOSP
Bug: 146080380
Test: manual
Change-Id: I09b33a34ff1ac7f6e415b7bd090c22e7df24d72d
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index f8ed61c..67bc939 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -932,26 +932,26 @@
return ok();
}
-binder::Status VoldNativeService::incFsVersion(int32_t* _aidl_return) {
- *_aidl_return = IncFs_Version();
+binder::Status VoldNativeService::incFsEnabled(bool* _aidl_return) {
+ *_aidl_return = IncFs_IsEnabled();
return ok();
}
binder::Status VoldNativeService::mountIncFs(
- const std::string& imagePath, const std::string& targetDir, int32_t flags,
+ const std::string& backingPath, const std::string& targetDir, int32_t flags,
::android::os::incremental::IncrementalFileSystemControlParcel* _aidl_return) {
- auto result = IncFs_Mount(imagePath.c_str(), targetDir.c_str(), flags,
- INCFS_DEFAULT_READ_TIMEOUT_MS, 0777);
- if (result.cmdFd < 0) {
- return translate(result.cmdFd);
+ auto result = IncFs_Mount(backingPath.c_str(), targetDir.c_str(),
+ {.flags = IncFsMountFlags(flags),
+ .defaultReadTimeoutMs = INCFS_DEFAULT_READ_TIMEOUT_MS,
+ .readLogBufferPages = 4});
+ if (result.cmd < 0) {
+ return translate(result.cmd);
}
- LOG(INFO) << "VoldNativeService::mountIncFs: everything is fine! " << result.cmdFd << "/"
- << result.logFd;
- using ParcelFileDescriptor = ::android::os::ParcelFileDescriptor;
using unique_fd = ::android::base::unique_fd;
- _aidl_return->cmd = std::make_unique<ParcelFileDescriptor>(unique_fd(result.cmdFd));
- if (result.logFd >= 0) {
- _aidl_return->log = std::make_unique<ParcelFileDescriptor>(unique_fd(result.logFd));
+ _aidl_return->cmd.reset(unique_fd(result.cmd));
+ _aidl_return->pendingReads.reset(unique_fd(result.pendingReads));
+ if (result.logs >= 0) {
+ _aidl_return->log.reset(unique_fd(result.logs));
}
return ok();
}