summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthat <github@that.at>2014-10-27 21:50:45 +0100
committerDees Troy <dees_troy@teamw.in>2014-11-04 15:29:06 +0100
commit78d0c5fc25abf46205716f08be09e5b630f18d63 (patch)
treeea4c9b64614785c1c469a61b770a5903b1dffcdb
parentRemove dependence on build hax in makefiles (diff)
downloadandroid_bootable_recovery-78d0c5fc25abf46205716f08be09e5b630f18d63.tar
android_bootable_recovery-78d0c5fc25abf46205716f08be09e5b630f18d63.tar.gz
android_bootable_recovery-78d0c5fc25abf46205716f08be09e5b630f18d63.tar.bz2
android_bootable_recovery-78d0c5fc25abf46205716f08be09e5b630f18d63.tar.lz
android_bootable_recovery-78d0c5fc25abf46205716f08be09e5b630f18d63.tar.xz
android_bootable_recovery-78d0c5fc25abf46205716f08be09e5b630f18d63.tar.zst
android_bootable_recovery-78d0c5fc25abf46205716f08be09e5b630f18d63.zip
-rw-r--r--partitionmanager.cpp253
-rw-r--r--partitions.hpp15
2 files changed, 0 insertions, 268 deletions
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 721537496..71c1fcbb9 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -313,50 +313,6 @@ int TWPartitionManager::Mount_By_Path(string Path, bool Display_Error) {
return false;
}
-int TWPartitionManager::Mount_By_Block(string Block, bool Display_Error) {
- TWPartition* Part = Find_Partition_By_Block(Block);
-
- if (Part) {
- if (Part->Has_SubPartition) {
- std::vector<TWPartition*>::iterator subpart;
-
- for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
- if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point)
- (*subpart)->Mount(Display_Error);
- }
- return Part->Mount(Display_Error);
- } else
- return Part->Mount(Display_Error);
- }
- if (Display_Error)
- LOGERR("Mount: Unable to find partition for block '%s'\n", Block.c_str());
- else
- LOGINFO("Mount: Unable to find partition for block '%s'\n", Block.c_str());
- return false;
-}
-
-int TWPartitionManager::Mount_By_Name(string Name, bool Display_Error) {
- TWPartition* Part = Find_Partition_By_Name(Name);
-
- if (Part) {
- if (Part->Has_SubPartition) {
- std::vector<TWPartition*>::iterator subpart;
-
- for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
- if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point)
- (*subpart)->Mount(Display_Error);
- }
- return Part->Mount(Display_Error);
- } else
- return Part->Mount(Display_Error);
- }
- if (Display_Error)
- LOGERR("Mount: Unable to find partition for name '%s'\n", Name.c_str());
- else
- LOGINFO("Mount: Unable to find partition for name '%s'\n", Name.c_str());
- return false;
-}
-
int TWPartitionManager::UnMount_By_Path(string Path, bool Display_Error) {
std::vector<TWPartition*>::iterator iter;
int ret = false;
@@ -382,50 +338,6 @@ int TWPartitionManager::UnMount_By_Path(string Path, bool Display_Error) {
return false;
}
-int TWPartitionManager::UnMount_By_Block(string Block, bool Display_Error) {
- TWPartition* Part = Find_Partition_By_Block(Block);
-
- if (Part) {
- if (Part->Has_SubPartition) {
- std::vector<TWPartition*>::iterator subpart;
-
- for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
- if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point)
- (*subpart)->UnMount(Display_Error);
- }
- return Part->UnMount(Display_Error);
- } else
- return Part->UnMount(Display_Error);
- }
- if (Display_Error)
- LOGERR("UnMount: Unable to find partition for block '%s'\n", Block.c_str());
- else
- LOGINFO("UnMount: Unable to find partition for block '%s'\n", Block.c_str());
- return false;
-}
-
-int TWPartitionManager::UnMount_By_Name(string Name, bool Display_Error) {
- TWPartition* Part = Find_Partition_By_Name(Name);
-
- if (Part) {
- if (Part->Has_SubPartition) {
- std::vector<TWPartition*>::iterator subpart;
-
- for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
- if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point)
- (*subpart)->UnMount(Display_Error);
- }
- return Part->UnMount(Display_Error);
- } else
- return Part->UnMount(Display_Error);
- }
- if (Display_Error)
- LOGERR("UnMount: Unable to find partition for name '%s'\n", Name.c_str());
- else
- LOGINFO("UnMount: Unable to find partition for name '%s'\n", Name.c_str());
- return false;
-}
-
int TWPartitionManager::Is_Mounted_By_Path(string Path) {
TWPartition* Part = Find_Partition_By_Path(Path);
@@ -436,26 +348,6 @@ int TWPartitionManager::Is_Mounted_By_Path(string Path) {
return false;
}
-int TWPartitionManager::Is_Mounted_By_Block(string Block) {
- TWPartition* Part = Find_Partition_By_Block(Block);
-
- if (Part)
- return Part->Is_Mounted();
- else
- LOGINFO("Is_Mounted: Unable to find partition for block '%s'\n", Block.c_str());
- return false;
-}
-
-int TWPartitionManager::Is_Mounted_By_Name(string Name) {
- TWPartition* Part = Find_Partition_By_Name(Name);
-
- if (Part)
- return Part->Is_Mounted();
- else
- LOGINFO("Is_Mounted: Unable to find partition for name '%s'\n", Name.c_str());
- return false;
-}
-
int TWPartitionManager::Mount_Current_Storage(bool Display_Error) {
string current_storage_path = DataManager::GetCurrentStoragePath();
@@ -483,26 +375,6 @@ TWPartition* TWPartitionManager::Find_Partition_By_Path(string Path) {
return NULL;
}
-TWPartition* TWPartitionManager::Find_Partition_By_Block(string Block) {
- std::vector<TWPartition*>::iterator iter;
-
- for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
- if ((*iter)->Primary_Block_Device == Block || (*iter)->Alternate_Block_Device == Block || ((*iter)->Is_Decrypted && (*iter)->Decrypted_Block_Device == Block))
- return (*iter);
- }
- return NULL;
-}
-
-TWPartition* TWPartitionManager::Find_Partition_By_Name(string Name) {
- std::vector<TWPartition*>::iterator iter;
-
- for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
- if ((*iter)->Display_Name == Name)
- return (*iter);
- }
- return NULL;
-}
-
int TWPartitionManager::Check_Backup_Name(bool Display_Error) {
// Check the backup name to ensure that it is the correct size and contains only valid characters
// and that a backup with that name doesn't already exist
@@ -1108,44 +980,6 @@ int TWPartitionManager::Wipe_By_Path(string Path) {
return false;
}
-int TWPartitionManager::Wipe_By_Block(string Block) {
- TWPartition* Part = Find_Partition_By_Block(Block);
-
- if (Part) {
- if (Part->Has_SubPartition) {
- std::vector<TWPartition*>::iterator subpart;
-
- for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
- if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point)
- (*subpart)->Wipe();
- }
- return Part->Wipe();
- } else
- return Part->Wipe();
- }
- LOGERR("Wipe: Unable to find partition for block '%s'\n", Block.c_str());
- return false;
-}
-
-int TWPartitionManager::Wipe_By_Name(string Name) {
- TWPartition* Part = Find_Partition_By_Name(Name);
-
- if (Part) {
- if (Part->Has_SubPartition) {
- std::vector<TWPartition*>::iterator subpart;
-
- for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
- if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point)
- (*subpart)->Wipe();
- }
- return Part->Wipe();
- } else
- return Part->Wipe();
- }
- LOGERR("Wipe: Unable to find partition for name '%s'\n", Name.c_str());
- return false;
-}
-
int TWPartitionManager::Wipe_By_Path(string Path, string New_File_System) {
std::vector<TWPartition*>::iterator iter;
int ret = false;
@@ -1171,44 +1005,6 @@ int TWPartitionManager::Wipe_By_Path(string Path, string New_File_System) {
return false;
}
-int TWPartitionManager::Wipe_By_Block(string Block, string New_File_System) {
- TWPartition* Part = Find_Partition_By_Block(Block);
-
- if (Part) {
- if (Part->Has_SubPartition) {
- std::vector<TWPartition*>::iterator subpart;
-
- for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
- if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point)
- (*subpart)->Wipe(New_File_System);
- }
- return Part->Wipe(New_File_System);
- } else
- return Part->Wipe(New_File_System);
- }
- LOGERR("Wipe: Unable to find partition for block '%s'\n", Block.c_str());
- return false;
-}
-
-int TWPartitionManager::Wipe_By_Name(string Name, string New_File_System) {
- TWPartition* Part = Find_Partition_By_Name(Name);
-
- if (Part) {
- if (Part->Has_SubPartition) {
- std::vector<TWPartition*>::iterator subpart;
-
- for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
- if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point)
- (*subpart)->Wipe();
- }
- return Part->Wipe(New_File_System);
- } else
- return Part->Wipe(New_File_System);
- }
- LOGERR("Wipe: Unable to find partition for name '%s'\n", Name.c_str());
- return false;
-}
-
int TWPartitionManager::Factory_Reset(void) {
std::vector<TWPartition*>::iterator iter;
int ret = true;
@@ -1385,55 +1181,6 @@ int TWPartitionManager::Repair_By_Path(string Path, bool Display_Error) {
return false;
}
-int TWPartitionManager::Repair_By_Block(string Block, bool Display_Error) {
- TWPartition* Part = Find_Partition_By_Block(Block);
-
- if (Part) {
- if (Part->Has_SubPartition) {
- std::vector<TWPartition*>::iterator subpart;
-
- for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
- if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point)
- (*subpart)->Repair();
- }
- return Part->Repair();
- } else
- return Part->Repair();
- }
- if (Display_Error)
- LOGERR("Repair: Unable to find partition for block '%s'\n", Block.c_str());
- else
- LOGINFO("Repair: Unable to find partition for block '%s'\n", Block.c_str());
- return false;
-}
-
-int TWPartitionManager::Repair_By_Name(string Name, bool Display_Error) {
- TWPartition* Part = Find_Partition_By_Name(Name);
-
- if (Part) {
- if (Part->Has_SubPartition) {
- std::vector<TWPartition*>::iterator subpart;
-
- for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
- if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point)
- (*subpart)->Repair();
- }
- return Part->Repair();
- } else
- return Part->Repair();
- }
- if (Display_Error)
- LOGERR("Repair: Unable to find partition for name '%s'\n", Name.c_str());
- else
- LOGINFO("Repair: Unable to find partition for name '%s'\n", Name.c_str());
- return false;
-}
-
-void TWPartitionManager::Refresh_Sizes(void) {
- Update_System_Details();
- return;
-}
-
void TWPartitionManager::Update_System_Details(void) {
std::vector<TWPartition*>::iterator iter;
int data_size = 0;
diff --git a/partitions.hpp b/partitions.hpp
index 0a57f6506..3f5aadda7 100644
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -180,29 +180,17 @@ public:
int Write_Fstab(); // Creates /etc/fstab file that's used by the command line for mount commands
void Output_Partition_Logging(); // Outputs partition information to the log
int Mount_By_Path(string Path, bool Display_Error); // Mounts partition based on path (e.g. /system)
- int Mount_By_Block(string Block, bool Display_Error); // Mounts partition based on block device (e.g. /dev/block/mmcblk1p1)
- int Mount_By_Name(string Name, bool Display_Error); // Mounts partition based on display name (e.g. System)
int UnMount_By_Path(string Path, bool Display_Error); // Unmounts partition based on path
- int UnMount_By_Block(string Block, bool Display_Error); // Unmounts partition based on block device
- int UnMount_By_Name(string Name, bool Display_Error); // Unmounts partition based on display name
int Is_Mounted_By_Path(string Path); // Checks if partition is mounted based on path
- int Is_Mounted_By_Block(string Block); // Checks if partition is mounted based on block device
- int Is_Mounted_By_Name(string Name); // Checks if partition is mounted based on display name
int Mount_Current_Storage(bool Display_Error); // Mounts the current storage location
int Mount_Settings_Storage(bool Display_Error); // Mounts the settings file storage location (usually internal)
TWPartition* Find_Partition_By_Path(string Path); // Returns a pointer to a partition based on path
- TWPartition* Find_Partition_By_Block(string Block); // Returns a pointer to a partition based on block device
- TWPartition* Find_Partition_By_Name(string Block); // Returns a pointer to a partition based on name
int Check_Backup_Name(bool Display_Error); // Checks the current backup name to ensure that it is valid
int Run_Backup(); // Initiates a backup in the current storage
int Run_Restore(string Restore_Name); // Restores a backup
void Set_Restore_Files(string Restore_Name); // Used to gather a list of available backup partitions for the user to select for a restore
int Wipe_By_Path(string Path); // Wipes a partition based on path
- int Wipe_By_Block(string Block); // Wipes a partition based on block device
- int Wipe_By_Name(string Name); // Wipes a partition based on display name
int Wipe_By_Path(string Path, string New_File_System); // Wipes a partition based on path
- int Wipe_By_Block(string Block, string New_File_System); // Wipes a partition based on block device
- int Wipe_By_Name(string Name, string New_File_System); // Wipes a partition based on display name
int Factory_Reset(); // Performs a factory reset
int Wipe_Dalvik_Cache(); // Wipes dalvik cache
int Wipe_Rotate_Data(); // Wipes rotation data --
@@ -211,9 +199,6 @@ public:
int Format_Data(); // Really formats data on /data/media devices -- also removes encryption
int Wipe_Media_From_Data(); // Removes and recreates the media folder on /data/media devices
int Repair_By_Path(string Path, bool Display_Error); // Repairs a partition based on path
- int Repair_By_Block(string Block, bool Display_Error); // Repairs a partition based on block device
- int Repair_By_Name(string Name, bool Display_Error); // Repairs a partition based on display name
- void Refresh_Sizes(); // Refreshes size data of partitions
void Update_System_Details(); // Updates fstab, file systems, sizes, etc.
int Decrypt_Device(string Password); // Attempt to decrypt any encrypted partitions
int usb_storage_enable(void); // Enable USB storage mode