Add vdc checkpoint supportsBlockCheckpoint
Also add vdc checkpoint supportsFileCheckpoint This is to allow tests to be specific to supported checkpoint mode. Test: Built on Taimen and Crosshatch, made sure both new functions work as expected Change-Id: I0eab7453b13c0a2e31840ef9ad24a692cec55b00
This commit is contained in:
parent
7573874d3f
commit
c5c79c5679
6 changed files with 54 additions and 0 deletions
|
@ -84,6 +84,30 @@ Status cp_supportsCheckpoint(bool& result) {
|
|||
return Status::ok();
|
||||
}
|
||||
|
||||
Status cp_supportsBlockCheckpoint(bool& result) {
|
||||
result = false;
|
||||
|
||||
for (const auto& entry : fstab_default) {
|
||||
if (entry.fs_mgr_flags.checkpoint_blk) {
|
||||
result = true;
|
||||
return Status::ok();
|
||||
}
|
||||
}
|
||||
return Status::ok();
|
||||
}
|
||||
|
||||
Status cp_supportsFileCheckpoint(bool& result) {
|
||||
result = false;
|
||||
|
||||
for (const auto& entry : fstab_default) {
|
||||
if (entry.fs_mgr_flags.checkpoint_fs) {
|
||||
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);
|
||||
|
|
|
@ -25,6 +25,10 @@ namespace vold {
|
|||
|
||||
android::binder::Status cp_supportsCheckpoint(bool& result);
|
||||
|
||||
android::binder::Status cp_supportsBlockCheckpoint(bool& result);
|
||||
|
||||
android::binder::Status cp_supportsFileCheckpoint(bool& result);
|
||||
|
||||
android::binder::Status cp_startCheckpoint(int retry);
|
||||
|
||||
android::binder::Status cp_commitChanges();
|
||||
|
|
|
@ -879,5 +879,19 @@ binder::Status VoldNativeService::supportsCheckpoint(bool* _aidl_return) {
|
|||
return cp_supportsCheckpoint(*_aidl_return);
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::supportsBlockCheckpoint(bool* _aidl_return) {
|
||||
ENFORCE_UID(AID_SYSTEM);
|
||||
ACQUIRE_LOCK;
|
||||
|
||||
return cp_supportsBlockCheckpoint(*_aidl_return);
|
||||
}
|
||||
|
||||
binder::Status VoldNativeService::supportsFileCheckpoint(bool* _aidl_return) {
|
||||
ENFORCE_UID(AID_SYSTEM);
|
||||
ACQUIRE_LOCK;
|
||||
|
||||
return cp_supportsFileCheckpoint(*_aidl_return);
|
||||
}
|
||||
|
||||
} // namespace vold
|
||||
} // namespace android
|
||||
|
|
|
@ -131,6 +131,8 @@ class VoldNativeService : public BinderService<VoldNativeService>, public os::Bn
|
|||
binder::Status markBootAttempt();
|
||||
binder::Status abortChanges();
|
||||
binder::Status supportsCheckpoint(bool* _aidl_return);
|
||||
binder::Status supportsBlockCheckpoint(bool* _aidl_return);
|
||||
binder::Status supportsFileCheckpoint(bool* _aidl_return);
|
||||
};
|
||||
|
||||
} // namespace vold
|
||||
|
|
|
@ -106,6 +106,8 @@ interface IVold {
|
|||
void restoreCheckpointPart(@utf8InCpp String device, int count);
|
||||
void markBootAttempt();
|
||||
boolean supportsCheckpoint();
|
||||
boolean supportsBlockCheckpoint();
|
||||
boolean supportsFileCheckpoint();
|
||||
|
||||
@utf8InCpp String createStubVolume(@utf8InCpp String sourcePath,
|
||||
@utf8InCpp String mountPath, @utf8InCpp String fsType,
|
||||
|
|
8
vdc.cpp
8
vdc.cpp
|
@ -109,6 +109,14 @@ int main(int argc, char** argv) {
|
|||
bool supported = false;
|
||||
checkStatus(vold->supportsCheckpoint(&supported));
|
||||
return supported ? 1 : 0;
|
||||
} else if (args[0] == "checkpoint" && args[1] == "supportsBlockCheckpoint" && args.size() == 2) {
|
||||
bool supported = false;
|
||||
checkStatus(vold->supportsBlockCheckpoint(&supported));
|
||||
return supported ? 1 : 0;
|
||||
} else if (args[0] == "checkpoint" && args[1] == "supportsFileCheckpoint" && args.size() == 2) {
|
||||
bool supported = false;
|
||||
checkStatus(vold->supportsFileCheckpoint(&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