fastboot: support for overriding format fs-type and size
This changes allows overriding the fs-type and size that
are normally returned by the booloader.
This is in preparation for supporting other FSes.
Change-Id: I8d141a0d4d14df9fe84d3b131484e9696fcd8870
Signed-off-by: JP Abgrall <jpa@google.com>
diff --git a/fastboot/engine.c b/fastboot/engine.c
index 0fab703..5a6709b 100644
--- a/fastboot/engine.c
+++ b/fastboot/engine.c
@@ -102,18 +102,20 @@
* Not all devices report the filesystem type, so don't report any errors,
* just return false.
*/
-int fb_format_supported(usb_handle *usb, const char *partition)
+int fb_format_supported(usb_handle *usb, const char *partition, const char *type_override)
{
- char response[FB_RESPONSE_SZ + 1] = {0,};
+ char fs_type[FB_RESPONSE_SZ + 1] = {0,};
int status;
unsigned int i;
- status = fb_getvar(usb, response, "partition-type:%s", partition);
+ if (type_override) {
+ return !!fs_get_generator(type_override);
+ }
+ status = fb_getvar(usb, fs_type, "partition-type:%s", partition);
if (status) {
return 0;
}
-
- return !!fs_get_generator(response);
+ return !!fs_get_generator(fs_type);
}
static int cb_default(Action *a, int status, char *resp)