summaryrefslogtreecommitdiffstats
path: root/fs_mgr
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2014-07-02 14:26:54 -0700
committerJP Abgrall <jpa@google.com>2014-07-02 14:28:50 -0700
commitcee206880ef80ac570df6b369d12f111c00f653a (patch)
tree562e7100d04e0325a9b1bbbe93dbf909402035c5 /fs_mgr
parentf22b7452940c99b830749cabdd929f9f7cfdaacc (diff)
downloadsystem_core-cee206880ef80ac570df6b369d12f111c00f653a.zip
system_core-cee206880ef80ac570df6b369d12f111c00f653a.tar.gz
system_core-cee206880ef80ac570df6b369d12f111c00f653a.tar.bz2
[HACK]fs_mgr+init: Format via recovery if encryptable /data is wiped
If the encryptable partition is wiped (4KB worth of 0 or 0xff), then reboot into recovery to format /data+/cache This is while waiting for the Mac OS support to format f2fs. The flashstation running on Mac OS will currently just erase userdata and not format it with f2fs. Bug: 15720406 Bug: 15747366 Change-Id: Ib7cca3e1701483a09573457a835750f34da71ee0
Diffstat (limited to 'fs_mgr')
-rw-r--r--fs_mgr/fs_mgr.c10
-rw-r--r--fs_mgr/include/fs_mgr.h1
2 files changed, 7 insertions, 4 deletions
diff --git a/fs_mgr/fs_mgr.c b/fs_mgr/fs_mgr.c
index f01c562..3f94af5 100644
--- a/fs_mgr/fs_mgr.c
+++ b/fs_mgr/fs_mgr.c
@@ -387,10 +387,12 @@ int fs_mgr_mount_all(struct fstab *fstab)
/* mount(2) returned an error, check if it's encryptable and deal with it */
if (mret && mount_errno != EBUSY && mount_errno != EACCES &&
- fs_mgr_is_encryptable(&fstab->recs[i])) {
- if (partition_wiped(fstab->recs[i].blk_device)) {
- ERROR("%s(): Encryptable wiped partition %s. Recommend wiping via recovery. Fail for now.\n", __func__, fstab->recs[i].mount_point);
- ++error_count;
+ fs_mgr_is_encryptable(&fstab->recs[attempted_idx])) {
+ if(partition_wiped(fstab->recs[attempted_idx].blk_device)) {
+ ERROR("%s(): %s is wiped and %s %s is encryptable. Suggest recovery...\n", __func__,
+ fstab->recs[attempted_idx].blk_device, fstab->recs[attempted_idx].mount_point,
+ fstab->recs[attempted_idx].fs_type);
+ encryptable = FS_MGR_MNTALL_DEV_NEEDS_RECOVERY;
continue;
} else {
/* Need to mount a tmpfs at this mountpoint for now, and set
diff --git a/fs_mgr/include/fs_mgr.h b/fs_mgr/include/fs_mgr.h
index ab3f828..d9c58d4 100644
--- a/fs_mgr/include/fs_mgr.h
+++ b/fs_mgr/include/fs_mgr.h
@@ -54,6 +54,7 @@ struct fstab_rec {
struct fstab *fs_mgr_read_fstab(const char *fstab_path);
void fs_mgr_free_fstab(struct fstab *fstab);
+#define FS_MGR_MNTALL_DEV_NEEDS_RECOVERY 3
#define FS_MGR_MNTALL_DEV_NEEDS_ENCRYPTION 2
#define FS_MGR_MNTALL_DEV_MIGHT_BE_ENCRYPTED 1
#define FS_MGR_MNTALL_DEV_NOT_ENCRYPTED 0