aboutsummaryrefslogtreecommitdiffstats
path: root/flashutils
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2011-05-26 17:30:43 -0700
committerKoushik Dutta <koushd@gmail.com>2011-05-26 17:30:43 -0700
commit4187347329543d168d45193bb6e086031b967e82 (patch)
tree4657630fc3e98bb5583c1f19b529b9775d7f1760 /flashutils
parent7adeadce47e326e88b4cf7e8d51b3aec9740a511 (diff)
downloadbootable_recovery-4187347329543d168d45193bb6e086031b967e82.zip
bootable_recovery-4187347329543d168d45193bb6e086031b967e82.tar.gz
bootable_recovery-4187347329543d168d45193bb6e086031b967e82.tar.bz2
fix formatting
Change-Id: Ic6162e5044b50544fab2d5aa83e1e22f373419d7
Diffstat (limited to 'flashutils')
-rw-r--r--flashutils/flashutils.c18
-rw-r--r--flashutils/flashutils.h1
2 files changed, 13 insertions, 6 deletions
diff --git a/flashutils/flashutils.c b/flashutils/flashutils.c
index 2f8da41..7fa38a9 100644
--- a/flashutils/flashutils.c
+++ b/flashutils/flashutils.c
@@ -70,6 +70,17 @@ __system(const char *command)
return (pid == -1 ? -1 : pstat);
}
+int get_flash_type(const char* partitionType) {
+ int type = UNSUPPORTED;
+ if (strcmp(partitionType, "mtd") == 0)
+ type = MTD;
+ else if (strcmp(partitionType, "emmc") == 0)
+ type = MMC;
+ else if (strcmp(partitionType, "bml") == 0)
+ type = BML;
+ return type;
+}
+
static int detect_partition(const char *partitionType, const char *partition)
{
int type = device_flash_type();
@@ -81,12 +92,7 @@ static int detect_partition(const char *partitionType, const char *partition)
type = BML;
if (partitionType != NULL) {
- if (strstr(partitionType, "mtd") != NULL)
- type = MTD;
- else if (strstr(partitionType, "emmc") != NULL)
- type = MMC;
- else if (strstr(partitionType, "bml") != NULL)
- type = BML;
+ type = get_flash_type(partitionType);
}
printf("partitionType: %s\n", partitionType);
diff --git a/flashutils/flashutils.h b/flashutils/flashutils.h
index 4c63c67..dd59537 100644
--- a/flashutils/flashutils.h
+++ b/flashutils/flashutils.h
@@ -39,6 +39,7 @@ extern int cmd_bml_mount_partition(const char *partition, const char *mount_poin
extern int cmd_bml_get_partition_device(const char *partition, char *device);
extern int device_flash_type();
+extern int get_flash_type(const char* fs_type);
enum flash_type {
UNSUPPORTED = -1,