From 59d86b4cf783be80724385330889bb7b876e9aed Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sun, 6 Mar 2011 15:18:48 -0800 Subject: [PATCH] fix wimax backup for emmc Change-Id: I3da8a3d9411b52e07bebe6214f86dd12ac98bb82 --- Android.mk | 2 +- mmcutils/mmcutils.c | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Android.mk b/Android.mk index 395bfa3..44759b6 100644 --- a/Android.mk +++ b/Android.mk @@ -26,7 +26,7 @@ LOCAL_MODULE := recovery LOCAL_FORCE_STATIC_EXECUTABLE := true -RECOVERY_VERSION := ClockworkMod Recovery v3.0.1.3 +RECOVERY_VERSION := ClockworkMod Recovery v3.0.1.4 LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) diff --git a/mmcutils/mmcutils.c b/mmcutils/mmcutils.c index e0efe55..fc3de5b 100644 --- a/mmcutils/mmcutils.c +++ b/mmcutils/mmcutils.c @@ -464,9 +464,8 @@ ERROR3: } -// TODO: refactor this to not be a giant copy paste mess int -mmc_raw_dump (const MmcPartition *partition, char *out_file) { +mmc_raw_dump_internal (const char* in_file, const char *out_file) { int ch; FILE *in; FILE *out; @@ -475,7 +474,6 @@ mmc_raw_dump (const MmcPartition *partition, char *out_file) { unsigned sz = 0; unsigned i; int ret = -1; - char *in_file = partition->device_index; in = fopen ( in_file, "r" ); if (in == NULL) @@ -516,6 +514,12 @@ ERROR3: } +// TODO: refactor this to not be a giant copy paste mess +int +mmc_raw_dump (const MmcPartition *partition, char *out_file) { + return mmc_raw_dump_internal(partition->device_index, out_file); +} + int mmc_raw_read (const MmcPartition *partition, char *data, int data_size) { @@ -586,11 +590,16 @@ int cmd_mmc_restore_raw_partition(const char *partition, const char *filename) int cmd_mmc_backup_raw_partition(const char *partition, const char *filename) { mmc_scan_partitions(); - const MmcPartition *p; - p = mmc_find_partition_by_name(partition); - if (p == NULL) - return -1; - return mmc_raw_dump(p, filename); + if (partition[0] != '/') { + const MmcPartition *p; + p = mmc_find_partition_by_name(partition); + if (p == NULL) + return -1; + return mmc_raw_dump(p, filename); + } + else { + return mmc_raw_dump_internal(partition, filename); + } } int cmd_mmc_erase_raw_partition(const char *partition)