summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorigoriok <sorocean.igor@gmail.com>2013-01-31 20:03:53 +0100
committerDees_Troy <dees_troy@teamw.in>2013-02-19 18:47:43 +0100
commit87e3d93edc01e3a43529303dc6c9bfe041583bcc (patch)
treeb368a441620235920124d98279b3b745339bba03
parentAdd TW_USE_MODEL_HADWARE_ID_FOR_DEVICE_ID parameter for correct model identification (diff)
downloadandroid_bootable_recovery-87e3d93edc01e3a43529303dc6c9bfe041583bcc.tar
android_bootable_recovery-87e3d93edc01e3a43529303dc6c9bfe041583bcc.tar.gz
android_bootable_recovery-87e3d93edc01e3a43529303dc6c9bfe041583bcc.tar.bz2
android_bootable_recovery-87e3d93edc01e3a43529303dc6c9bfe041583bcc.tar.lz
android_bootable_recovery-87e3d93edc01e3a43529303dc6c9bfe041583bcc.tar.xz
android_bootable_recovery-87e3d93edc01e3a43529303dc6c9bfe041583bcc.tar.zst
android_bootable_recovery-87e3d93edc01e3a43529303dc6c9bfe041583bcc.zip
Diffstat (limited to '')
-rw-r--r--partition.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/partition.cpp b/partition.cpp
index 73aa8af16..6070775c3 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -620,6 +620,29 @@ bool TWPartition::Find_Partition_Size(void) {
char line[512];
string tmpdevice;
+ fp = fopen("/proc/dumchar_info", "rt");
+ if (fp != NULL) {
+ while (fgets(line, sizeof(line), fp) != NULL)
+ {
+ char label[32], device[32];
+ unsigned long size = 0;
+
+ sscanf(line, "%s %lx %*lx %*lu %s", label, &size, device);
+
+ // Skip header, annotation and blank lines
+ if ((strncmp(device, "/dev/", 5) != 0) || (strlen(line) < 8))
+ continue;
+
+ tmpdevice = "/dev/";
+ tmpdevice += label;
+ if (tmpdevice == Primary_Block_Device || tmpdevice == Alternate_Block_Device) {
+ Size = size;
+ fclose(fp);
+ return true;
+ }
+ }
+ }
+
// In this case, we'll first get the partitions we care about (with labels)
fp = fopen("/proc/partitions", "rt");
if (fp == NULL)
@@ -1344,10 +1367,13 @@ bool TWPartition::Backup_Tar(string backup_folder) {
}
bool TWPartition::Backup_DD(string backup_folder) {
- char back_name[255];
- string Full_FileName, Command, result;
+ char back_name[255], backup_size[32];
+ string Full_FileName, Command, result, DD_BS;
int use_compression;
+ sprintf(backup_size, "%llu", Backup_Size);
+ DD_BS = backup_size;
+
TWFunc::GUI_Operation_Text(TW_BACKUP_TEXT, Display_Name, "Backing Up");
ui_print("Backing up %s...\n", Display_Name.c_str());
@@ -1356,7 +1382,7 @@ bool TWPartition::Backup_DD(string backup_folder) {
Full_FileName = backup_folder + "/" + Backup_FileName;
- Command = "dd if=" + Actual_Block_Device + " of='" + Full_FileName + "'";
+ Command = "dd if=" + Actual_Block_Device + " of='" + Full_FileName + "'" + " bs=" + DD_BS + "c count=1";
LOGI("Backup command: '%s'\n", Command.c_str());
TWFunc::Exec_Cmd(Command, result);
if (TWFunc::Get_File_Size(Full_FileName) == 0) {