From 3497cb5be5f9af324a2798eb76a6c17dfdacd78d Mon Sep 17 00:00:00 2001 From: Yurii Zubrytskyi Date: Fri, 10 Jan 2020 11:54:06 -0800 Subject: [PATCH] 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 --- VoldNativeService.cpp | 28 ++++++++++++++-------------- VoldNativeService.h | 4 ++-- binder/android/os/IVold.aidl | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp index f8ed61c..67bc939 100644 --- a/VoldNativeService.cpp +++ b/VoldNativeService.cpp @@ -932,26 +932,26 @@ binder::Status VoldNativeService::resetCheckpoint() { 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); - } - LOG(INFO) << "VoldNativeService::mountIncFs: everything is fine! " << result.cmdFd << "/" - << result.logFd; - using ParcelFileDescriptor = ::android::os::ParcelFileDescriptor; + 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); + } using unique_fd = ::android::base::unique_fd; - _aidl_return->cmd = std::make_unique(unique_fd(result.cmdFd)); - if (result.logFd >= 0) { - _aidl_return->log = std::make_unique(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(); } diff --git a/VoldNativeService.h b/VoldNativeService.h index 2967fae..7de2a67 100644 --- a/VoldNativeService.h +++ b/VoldNativeService.h @@ -146,9 +146,9 @@ class VoldNativeService : public BinderService, public os::Bn binder::Status supportsFileCheckpoint(bool* _aidl_return); binder::Status resetCheckpoint(); - binder::Status incFsVersion(int32_t* _aidl_return) override; + binder::Status incFsEnabled(bool* _aidl_return) override; binder::Status 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) override; binder::Status unmountIncFs(const std::string& dir) override; binder::Status bindMount(const std::string& sourceDir, const std::string& targetDir) override; diff --git a/binder/android/os/IVold.aidl b/binder/android/os/IVold.aidl index 1819e09..f1e463a 100644 --- a/binder/android/os/IVold.aidl +++ b/binder/android/os/IVold.aidl @@ -130,8 +130,8 @@ interface IVold { FileDescriptor openAppFuseFile(int uid, int mountId, int fileId, int flags); - int incFsVersion(); - IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String imagePath, @utf8InCpp String targetDir, int flags); + boolean incFsEnabled(); + IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String backingPath, @utf8InCpp String targetDir, int flags); void unmountIncFs(@utf8InCpp String dir); void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir);