Merge "Handle retry count" am: e74587af4d am: e1e3dc3698

am: c879ec2005

Change-Id: Ib1a614d3e3a964afc36585c9ca323e7a4cf97a39
This commit is contained in:
Daniel Rosenberg 2018-10-15 22:30:14 -07:00 committed by android-build-merger
commit cf540f3513
6 changed files with 10 additions and 13 deletions

View file

@ -66,7 +66,7 @@ bool setBowState(std::string const& block_device, std::string const& state) {
bool cp_startCheckpoint(int retry) { bool cp_startCheckpoint(int retry) {
if (retry < -1) return false; if (retry < -1) return false;
std::string content = std::to_string(retry); std::string content = std::to_string(retry + 1);
if (retry == -1) { if (retry == -1) {
sp<IBootControl> module = IBootControl::getService(); sp<IBootControl> module = IBootControl::getService();
if (module) { if (module) {
@ -136,7 +136,7 @@ bool cp_needsRollback() {
return false; return false;
} }
bool cp_needsCheckpoint(void) { bool cp_needsCheckpoint() {
bool ret; bool ret;
std::string content; std::string content;
sp<IBootControl> module = IBootControl::getService(); sp<IBootControl> module = IBootControl::getService();
@ -148,7 +148,7 @@ bool cp_needsCheckpoint(void) {
return false; return false;
} }
bool cp_prepareDriveForCheckpoint(const std::string&) { bool cp_prepareCheckpoint() {
auto fstab_default = std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)>{ auto fstab_default = std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)>{
fs_mgr_read_fstab_default(), fs_mgr_free_fstab}; fs_mgr_read_fstab_default(), fs_mgr_free_fstab};
if (!fstab_default) return false; if (!fstab_default) return false;

View file

@ -32,7 +32,7 @@ bool cp_needsRollback();
bool cp_needsCheckpoint(); bool cp_needsCheckpoint();
bool cp_prepareDriveForCheckpoint(const std::string& mountPoint); bool cp_prepareCheckpoint();
bool cp_restoreCheckpoint(const std::string& mountPoint); bool cp_restoreCheckpoint(const std::string& mountPoint);

View file

@ -942,13 +942,11 @@ binder::Status VoldNativeService::commitChanges(bool* _aidl_return) {
return ok(); return ok();
} }
binder::Status VoldNativeService::prepareDriveForCheckpoint(const std::string& mountPoint, binder::Status VoldNativeService::prepareCheckpoint(bool* _aidl_return) {
bool* _aidl_return) {
ENFORCE_UID(AID_SYSTEM); ENFORCE_UID(AID_SYSTEM);
CHECK_ARGUMENT_PATH(mountPoint);
ACQUIRE_LOCK; ACQUIRE_LOCK;
*_aidl_return = cp_prepareDriveForCheckpoint(mountPoint); *_aidl_return = cp_prepareCheckpoint();
return ok(); return ok();
} }

View file

@ -125,7 +125,7 @@ class VoldNativeService : public BinderService<VoldNativeService>, public os::Bn
binder::Status needsCheckpoint(bool* _aidl_return); binder::Status needsCheckpoint(bool* _aidl_return);
binder::Status needsRollback(bool* _aidl_return); binder::Status needsRollback(bool* _aidl_return);
binder::Status commitChanges(bool* _aidl_return); binder::Status commitChanges(bool* _aidl_return);
binder::Status prepareDriveForCheckpoint(const std::string& mountPoint, bool* _aidl_return); binder::Status prepareCheckpoint(bool* _aidl_return);
binder::Status restoreCheckpoint(const std::string& mountPoint, bool* _aidl_return); binder::Status restoreCheckpoint(const std::string& mountPoint, bool* _aidl_return);
binder::Status markBootAttempt(bool* __aidl_return); binder::Status markBootAttempt(bool* __aidl_return);
binder::Status abortChanges(); binder::Status abortChanges();

View file

@ -109,7 +109,7 @@ interface IVold {
boolean needsRollback(); boolean needsRollback();
void abortChanges(); void abortChanges();
boolean commitChanges(); boolean commitChanges();
boolean prepareDriveForCheckpoint(@utf8InCpp String mountPoint); boolean prepareCheckpoint();
boolean restoreCheckpoint(@utf8InCpp String device); boolean restoreCheckpoint(@utf8InCpp String device);
boolean markBootAttempt(); boolean markBootAttempt();

View file

@ -123,10 +123,9 @@ int main(int argc, char** argv) {
bool success = false; bool success = false;
checkStatus(vold->commitChanges(&success)); checkStatus(vold->commitChanges(&success));
return success ? 1 : 0; return success ? 1 : 0;
} else if (args[0] == "checkpoint" && args[1] == "prepareDriveForCheckpoint" && } else if (args[0] == "checkpoint" && args[1] == "prepareCheckpoint" && args.size() == 2) {
args.size() == 3) {
bool success = false; bool success = false;
checkStatus(vold->prepareDriveForCheckpoint(args[2], &success)); checkStatus(vold->prepareCheckpoint(&success));
return success ? 1 : 0; return success ? 1 : 0;
} else if (args[0] == "checkpoint" && args[1] == "restoreCheckpoint" && args.size() == 3) { } else if (args[0] == "checkpoint" && args[1] == "restoreCheckpoint" && args.size() == 3) {
bool success = false; bool success = false;