diff options
author | Pawit Pornkitprasan <p.pawit@gmail.com> | 2011-12-06 16:19:32 +0700 |
---|---|---|
committer | Koushik Dutta <koushd@gmail.com> | 2012-01-26 15:16:53 -0800 |
commit | aa3c3d429bbbe12ee30ade7edd683d6e4884cb45 (patch) | |
tree | c9d51aa75f259206152a8fd758128a56fa2bd523 /extendedcommands.c | |
parent | cd3705e4aba68274f7033a32bfc0d9b1010a4513 (diff) | |
download | bootable_recovery-aa3c3d429bbbe12ee30ade7edd683d6e4884cb45.zip bootable_recovery-aa3c3d429bbbe12ee30ade7edd683d6e4884cb45.tar.gz bootable_recovery-aa3c3d429bbbe12ee30ade7edd683d6e4884cb45.tar.bz2 |
Respect volume length when formatting ext4 when restoring
This is needed for device encryption to work properly (there must
be space for a 16 KB footer at the end of the partition, which is
usually specified by the length option).
And yes, the old signature of make_ext4fs was wrong, but worked
anyway because the related header was not included and the compiler
let it pass an as implicit delcaration.
Change-Id: Ied7ec70bebc120cc2917771f59eeaeb7ea76bf8d
Diffstat (limited to 'extendedcommands.c')
-rw-r--r-- | extendedcommands.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/extendedcommands.c b/extendedcommands.c index af67c3e..43d449a 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -25,6 +25,7 @@ #include "cutils/properties.h" #include "firmware.h" #include "install.h" +#include "make_ext4fs.h" #include "minui/minui.h" #include "minzip/DirUtil.h" #include "roots.h" @@ -507,8 +508,13 @@ int format_device(const char *device, const char *path, const char *fs_type) { } if (strcmp(fs_type, "ext4") == 0) { + int length = 0; + if (strcmp(v->fs_type, "ext4") == 0) { + // Our desired filesystem matches the one in fstab, respect v->length + length = v->length; + } reset_ext4fs_info(); - int result = make_ext4fs(device, NULL, NULL, 0, 0, 0); + int result = make_ext4fs(device, length); if (result != 0) { LOGE("format_volume: make_extf4fs failed on %s\n", device); return -1; |