Commit graph

15 commits

Author SHA1 Message Date
Tom Cherry
4c5bde2b92 Move over to the C++ Fstab class
Test: build and boot
Change-Id: Id3850c9c133f6644073a2439368501253a2a94a9
2019-01-31 12:34:39 -08:00
Treehugger Robot
aaac873faf Merge "Preserve options on remount in commitChanges" 2019-01-25 04:26:17 +00:00
Daniel Rosenberg
14ca4acd86 Preserve options on remount in commitChanges
Copy the existing mount options when remounting f2fs for checkpointing
mode.

Bug: 123376509
Test: Boot with checkpointing, and ensure entries match fstab
Change-Id: If022d9872a44657b550ab892259230805716dc77
2019-01-24 18:26:53 -08:00
Daniel Rosenberg
9b667fbe41 Add supportsCheckpoint
This returns true if any entries in the fstab have checkpoint=
set.

Test: Call vdc checkpoint supportsCheckpoint. Should return 1
      iff an fstab entry has checkpoint=fs or checkpoint=block set
Bug: 111020314

Change-Id: Ic79bc96ded4da6605f73992dcff542e7cb50d705
2019-01-22 17:58:03 -08:00
Paul Lawrence
27691c2883 Checkpoints: Support validation and roll forward on fail
Test: Rolls backward, and if you hexedit a BOW page, rolls forward
Change-Id: If99a6c3a3bc3f615bd1445f5af14ea490a58e053
2019-01-16 14:14:48 -08:00
Greg Kaiser
8859c9c9e7 Checkpoint: Assure proper buffer alignment
We have a char buffer on the stack, which we then cast to a
struct, and then proceed to access elements in the struct.
This is not safe across all platforms, as some platforms
may require a certain alignment for members of the struct.
We fix this by assuring an appropriate alignment for our
char buffer.

We also use C++ casting, and rename our buffer to differenciate
it from the other 'buffer' variable in this function.

Test: TreeHugger
Change-Id: I8254cb6b8124e394bd805afd1ccca0faedb27ffa
2018-12-20 10:38:31 -08:00
Daniel Rosenberg
ffa1bb0370 Add property for checkpointing
We set a property when we commit a chackpoint to signal
to anyone who wants to do post commit cleanup.

Test: Boot to homescreen and check getprop for vold.checkpoint_committed
Bug: 111020314
Change-Id: Idf35e3abf9d24eb40c6926a30a8403064c05e10a
2018-12-14 14:55:16 -08:00
Daniel Rosenberg
4b86df1426 Fix error reporting in cp_commitChanges
Only trys to commit if necessary, and reports errors
if commiting fails. RemoveFileIfExists returns true on
success.

Test: vdc checkpoint startCheckpoint, reboot, and then
      vdc checkpoint commitChanges
Bug: 111020314

Change-Id: Ie1b3e49beb3ca04f2881fcc595882c607368b477
2018-11-19 23:47:03 +00:00
Daniel Rosenberg
73680ec382 Switch to exceptions for most cp calls
This switches the checkpoint calls that don't need to return a value
to return 0 on success, and an error on failure. This will be transalted
to exceptions for java binder users. needsCheckpoint and needsRollback
still return a boolean value.

Test: vdc setCheckpoint 2 then reboot 3 times checking state
Bug: 112901762
Change-Id: Idd3b5e6036631562a86d5123f533b86cf3bd6032
Merged-In: Idd3b5e6036631562a86d5123f533b86cf3bd6032
2018-10-16 20:06:47 +00:00
Daniel Rosenberg
80d1ca5600 Handle retry count
Test: vdc setCheckpoint 2 then reboot 3 times checking state
Bug: 112901762
Change-Id: I85a71d059bca27b76175b9bd8465cc453f0ddb8d
2018-10-15 22:13:41 +00:00
Daniel Rosenberg
ba1752008d Merge "Add checkpointing support for A/B updates" 2018-10-05 01:31:18 +00:00
Daniel Rosenberg
d399249855 Add checkpointing support for A/B updates
This adds implicit rollback support during A/B style updates.
If you explicitly start a checkpoint with -1, needsRollback will
trigger if the update fails, and should be used if any additional
cleanup is needed that is not covered by A/B itself.

Test: All Checkpoint tests pass
Bug: 111020314
Change-Id: I88b4a1098c6bac4dc1438a54c8a8f59577a6c17b
2018-10-03 15:39:25 -07:00
Paul Lawrence
2040089ab0 Use unique points for fstab
Test: Checkpoint test script runs and passes
Change-Id: I13005da22aef5fda3d1e0941949db02ff0ff0870
2018-10-03 14:19:31 -07:00
Paul Lawrence
1abb2fe278 Make checkpointing work on ext4
Test: All tests pass
Change-Id: I2a6cdf1edfe752f4633e1931e75d18659653938c
2018-10-03 09:15:27 -07:00
Daniel Rosenberg
65f99c9e8b 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
Merged-In: Icba16578608a6cbf922472e9d4ae5b8cf5f016c6
Change-Id: Icba16578608a6cbf922472e9d4ae5b8cf5f016c6
2018-09-21 21:54:11 +00:00