Merge "[incremental] use vold to mount/unmount IncrementalFileSystem"
This commit is contained in:
commit
6bdfb77d8b
4 changed files with 55 additions and 1 deletions
|
@ -54,6 +54,7 @@ cc_defaults {
|
|||
"libf2fs_sparseblock",
|
||||
"libhardware",
|
||||
"libhardware_legacy",
|
||||
"libincfs",
|
||||
"libhidlbase",
|
||||
"libkeymaster4support",
|
||||
"libkeyutils",
|
||||
|
@ -78,9 +79,15 @@ cc_library_static {
|
|||
],
|
||||
aidl: {
|
||||
local_include_dirs: ["binder"],
|
||||
include_dirs: ["frameworks/native/aidl/binder"],
|
||||
include_dirs: [
|
||||
"frameworks/native/aidl/binder",
|
||||
"frameworks/base/core/java/android/os/incremental",
|
||||
],
|
||||
export_aidl_headers: true,
|
||||
},
|
||||
whole_static_libs: [
|
||||
"libincremental_aidl-cpp",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_headers {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "FsCrypt.h"
|
||||
#include "MetadataCrypt.h"
|
||||
#include "cryptfs.h"
|
||||
#include "incfs_ndk.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <thread>
|
||||
|
@ -915,5 +916,38 @@ binder::Status VoldNativeService::resetCheckpoint() {
|
|||
return ok();
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::incFsVersion(int32_t* _aidl_return) {
|
||||
*_aidl_return = IncFs_Version();
|
||||
return ok();
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::mountIncFs(
|
||||
const std::string& imagePath, 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;
|
||||
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));
|
||||
}
|
||||
return ok();
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::unmountIncFs(const std::string& dir) {
|
||||
return translate(IncFs_Unmount(dir.c_str()));
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::bindMount(const std::string& sourceDir,
|
||||
const std::string& targetDir) {
|
||||
return translate(IncFs_BindMount(sourceDir.c_str(), targetDir.c_str()));
|
||||
}
|
||||
|
||||
} // namespace vold
|
||||
} // namespace android
|
||||
|
|
|
@ -141,6 +141,13 @@ class VoldNativeService : public BinderService<VoldNativeService>, public os::Bn
|
|||
binder::Status supportsBlockCheckpoint(bool* _aidl_return);
|
||||
binder::Status supportsFileCheckpoint(bool* _aidl_return);
|
||||
binder::Status resetCheckpoint();
|
||||
|
||||
binder::Status incFsVersion(int32_t* _aidl_return) override;
|
||||
binder::Status mountIncFs(
|
||||
const std::string& imagePath, 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;
|
||||
};
|
||||
|
||||
} // namespace vold
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package android.os;
|
||||
|
||||
import android.os.incremental.IncrementalFileSystemControlParcel;
|
||||
import android.os.IVoldListener;
|
||||
import android.os.IVoldTaskListener;
|
||||
|
||||
|
@ -125,6 +126,11 @@ interface IVold {
|
|||
|
||||
FileDescriptor openAppFuseFile(int uid, int mountId, int fileId, int flags);
|
||||
|
||||
int incFsVersion();
|
||||
IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String imagePath, @utf8InCpp String targetDir, int flags);
|
||||
void unmountIncFs(@utf8InCpp String dir);
|
||||
void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir);
|
||||
|
||||
const int ENCRYPTION_FLAG_NO_UI = 4;
|
||||
|
||||
const int ENCRYPTION_STATE_NONE = 1;
|
||||
|
|
Loading…
Reference in a new issue