Reset partition flags when the partition is wiped

Change-Id: I6c4cee5b038fd0c39c8723412dd8f421f7794a00
Improve handling of undecrypted encrypted /data

- Until the encrypted partition is decrypted, treat it as a disk image
  instead of a filesystem so that it is properly backed up using dd.
- Make Partition::Wipe() use the filesystem from fstab for disk images
  so that wiping an undecrypted /data makes it a plain unencrypted
  partition again.

Change-Id: I78db977d6348cfa66b0cfbc492fb5776f84db48d
Work around MEMERASE ioctl for rk3066 compatibility

Due to a kernel bug and no available sources we have to work around the
MEMERASE ioctl - if used, it hangs and never returns. I straced the original
recovery executable and could see that it is simply calling write() with a
bunch of zeroes instead of using MEMERASE.

Added a hack that does the same and now the resulting TWRP recovery image works.

Change-Id: I1b1c1c9e870e350776346bdca5d442c7ef565aa0
Merge "Reset partition flags when the partition is wiped" into jb-wip
Merge "Improve handling of undecrypted encrypted /data" into jb-wip
Add mode when open(O_CREAT) is used.

When creating a new file using open(..., O_CREAT), it is an error
to fail to specify a creation mode. If a mode is not specified, a
random stack provided value is used as the "mode".

This will become a compile error in a future Android change.

Change-Id: I73c1e1a39ca36bf01704b07302af4971d234b5a8
Merge "Work around MEMERASE ioctl for rk3066 compatibility" into jb-wip
Fix up libmincrypt rules for Android 4.2
Merge "Fix up libmincrypt rules for Android 4.2" into jb-wip
Add Samsung TouchWiz decryption

Change-Id: I418680e59372160dabfe3e2d5f0208229aa151ae
Merge remote-tracking branch 'upstream/jb-wip' into jb-wip