Add support for checkpointing
Checkpointing uses a combination of files on the meta partition
and the checkpoint= fs_mgr flag. Checkpointed partitions will
revert to their starting state on reboot unless checkpoint commit
is called.
Test: Run vdc commands, check file on metadata
Change-Id: Icba16578608a6cbf922472e9d4ae5b8cf5f016c6
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index a99f75d..dcf3546 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -24,6 +24,7 @@
#include "Process.h"
#include "VolumeManager.h"
+#include "Checkpoint.h"
#include "Ext4Crypt.h"
#include "MetadataCrypt.h"
#include "cryptfs.h"
@@ -892,5 +893,55 @@
sandboxId, userId));
}
+binder::Status VoldNativeService::startCheckpoint(int32_t retry, bool* _aidl_return) {
+ ENFORCE_UID(AID_SYSTEM);
+ ACQUIRE_LOCK;
+
+ *_aidl_return = cp_startCheckpoint(retry);
+ return ok();
+}
+
+binder::Status VoldNativeService::needsCheckpoint(bool* _aidl_return) {
+ ENFORCE_UID(AID_SYSTEM);
+ ACQUIRE_LOCK;
+
+ *_aidl_return = cp_needsCheckpoint();
+ return ok();
+}
+
+binder::Status VoldNativeService::commitChanges(bool* _aidl_return) {
+ ENFORCE_UID(AID_SYSTEM);
+ ACQUIRE_LOCK;
+
+ *_aidl_return = cp_commitChanges();
+ return ok();
+}
+
+binder::Status VoldNativeService::prepareDriveForCheckpoint(const std::string& mountPoint,
+ bool* _aidl_return) {
+ ENFORCE_UID(AID_SYSTEM);
+ CHECK_ARGUMENT_PATH(mountPoint);
+ ACQUIRE_LOCK;
+
+ *_aidl_return = cp_prepareDriveForCheckpoint(mountPoint);
+ return ok();
+}
+
+binder::Status VoldNativeService::markBootAttempt(bool* _aidl_return) {
+ ENFORCE_UID(AID_SYSTEM);
+ ACQUIRE_LOCK;
+
+ *_aidl_return = cp_markBootAttempt();
+ return ok();
+}
+
+binder::Status VoldNativeService::abortChanges() {
+ ENFORCE_UID(AID_SYSTEM);
+ ACQUIRE_LOCK;
+
+ cp_abortChanges();
+ return ok();
+}
+
} // namespace vold
} // namespace android