Merge "Add supportsCheckpoint"
This commit is contained in:
commit
9b2b8fd459
6 changed files with 30 additions and 0 deletions
|
@ -67,6 +67,21 @@ bool setBowState(std::string const& block_device, std::string const& state) {
|
|||
|
||||
} // namespace
|
||||
|
||||
Status cp_supportsCheckpoint(bool& result) {
|
||||
result = false;
|
||||
auto fstab_default = std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)>{
|
||||
fs_mgr_read_fstab_default(), fs_mgr_free_fstab};
|
||||
if (!fstab_default) return Status::fromExceptionCode(EINVAL, "Failed to get fstab");
|
||||
|
||||
for (int i = 0; i < fstab_default->num_entries; ++i) {
|
||||
if (fs_mgr_is_checkpoint(&fstab_default->recs[i])) {
|
||||
result = true;
|
||||
return Status::ok();
|
||||
}
|
||||
}
|
||||
return Status::ok();
|
||||
}
|
||||
|
||||
Status cp_startCheckpoint(int retry) {
|
||||
if (retry < -1) return Status::fromExceptionCode(EINVAL, "Retry count must be more than -1");
|
||||
std::string content = std::to_string(retry + 1);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
namespace android {
|
||||
namespace vold {
|
||||
|
||||
android::binder::Status cp_supportsCheckpoint(bool& result);
|
||||
|
||||
android::binder::Status cp_startCheckpoint(int retry);
|
||||
|
||||
android::binder::Status cp_commitChanges();
|
||||
|
|
|
@ -864,5 +864,12 @@ binder::Status VoldNativeService::abortChanges() {
|
|||
return cp_abortChanges();
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::supportsCheckpoint(bool* _aidl_return) {
|
||||
ENFORCE_UID(AID_SYSTEM);
|
||||
ACQUIRE_LOCK;
|
||||
|
||||
return cp_supportsCheckpoint(*_aidl_return);
|
||||
}
|
||||
|
||||
} // namespace vold
|
||||
} // namespace android
|
||||
|
|
|
@ -129,6 +129,7 @@ class VoldNativeService : public BinderService<VoldNativeService>, public os::Bn
|
|||
binder::Status restoreCheckpoint(const std::string& mountPoint);
|
||||
binder::Status markBootAttempt();
|
||||
binder::Status abortChanges();
|
||||
binder::Status supportsCheckpoint(bool* _aidl_return);
|
||||
};
|
||||
|
||||
} // namespace vold
|
||||
|
|
|
@ -104,6 +104,7 @@ interface IVold {
|
|||
void prepareCheckpoint();
|
||||
void restoreCheckpoint(@utf8InCpp String device);
|
||||
void markBootAttempt();
|
||||
boolean supportsCheckpoint();
|
||||
|
||||
@utf8InCpp String createStubVolume(@utf8InCpp String sourcePath,
|
||||
@utf8InCpp String mountPath, @utf8InCpp String fsType,
|
||||
|
|
4
vdc.cpp
4
vdc.cpp
|
@ -105,6 +105,10 @@ int main(int argc, char** argv) {
|
|||
checkStatus(vold->mountFstab(args[2]));
|
||||
} else if (args[0] == "cryptfs" && args[1] == "encryptFstab" && args.size() == 3) {
|
||||
checkStatus(vold->encryptFstab(args[2]));
|
||||
} else if (args[0] == "checkpoint" && args[1] == "supportsCheckpoint" && args.size() == 2) {
|
||||
bool supported = false;
|
||||
checkStatus(vold->supportsCheckpoint(&supported));
|
||||
return supported ? 1 : 0;
|
||||
} else if (args[0] == "checkpoint" && args[1] == "startCheckpoint" && args.size() == 3) {
|
||||
int retry;
|
||||
if (!android::base::ParseInt(args[2], &retry)) exit(EINVAL);
|
||||
|
|
Loading…
Reference in a new issue