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
This commit is contained in:
		
				
					committed by
					
						 Koushik Dutta
						Koushik Dutta
					
				
			
			
				
	
			
			
			
						parent
						
							cd3705e4ab
						
					
				
				
					commit
					aa3c3d429b
				
			| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user