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
This commit is contained in:
Yurii Zubrytskyi 2020-01-10 11:54:06 -08:00
parent 24362685f0
commit 3497cb5be5
3 changed files with 17 additions and 17 deletions

View file

@ -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);
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();
}

View file

@ -146,9 +146,9 @@ class VoldNativeService : public BinderService<VoldNativeService>, 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;

View file

@ -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);