virtualboolIs_Mounted();// Checks mount to see if the partition is currently mounted
virtualboolMount(boolDisplay_Error);// Mounts the partition if it is not mounted
virtualboolUnMount(boolDisplay_Error);// Unmounts the partition if it is mounted
virtualboolWipe(stringNew_File_System);// Wipes the partition
virtualboolWipe();// Wipes the partition
virtualboolWipe_AndSec();// Wipes android secure
virtualboolBackup(stringbackup_folder);// Backs up the partition to the folder specified
virtualboolCheck_MD5(stringrestore_folder);// Checks MD5 of a backup
virtualboolRestore(stringrestore_folder);// Restores the partition using the backup folder provided
virtualstringBackup_Method_By_Name();// Returns a string of the backup method for human readable output
virtualboolDecrypt(stringPassword);// Decrypts the partition, return 0 for failure and -1 for success
virtualboolWipe_Encryption();// Ignores wipe commands for /data/media devices and formats the original block device
virtualvoidCheck_FS_Type();// Checks the fs type using blkid, does not do anything on MTD / yaffs2 because this crashes on some devices
virtualboolUpdate_Size(boolDisplay_Error);// Updates size information
virtualvoidRecreate_Media_Folder();// Recreates the /data/media folder
boolIs_Mounted();// Checks mount to see if the partition is currently mounted
boolMount(boolDisplay_Error);// Mounts the partition if it is not mounted
boolUnMount(boolDisplay_Error);// Unmounts the partition if it is mounted
boolWipe(stringNew_File_System);// Wipes the partition
boolWipe();// Wipes the partition
boolWipe_AndSec();// Wipes android secure
boolBackup(stringbackup_folder);// Backs up the partition to the folder specified
boolCheck_MD5(stringrestore_folder);// Checks MD5 of a backup
boolRestore(stringrestore_folder);// Restores the partition using the backup folder provided
stringBackup_Method_By_Name();// Returns a string of the backup method for human readable output
boolDecrypt(stringPassword);// Decrypts the partition, return 0 for failure and -1 for success
boolWipe_Encryption();// Ignores wipe commands for /data/media devices and formats the original block device
voidCheck_FS_Type();// Checks the fs type using blkid, does not do anything on MTD / yaffs2 because this crashes on some devices
boolUpdate_Size(boolDisplay_Error);// Updates size information
voidRecreate_Media_Folder();// Recreates the /data/media folder
public:
stringCurrent_File_System;// Current file system
stringActual_Block_Device;// Actual block device (one of primary, alternate, or decrypted)
stringMTD_Name;// Name of the partition for MTD devices
protected:
private:
boolProcess_Fstab_Line(stringLine,boolDisplay_Error);// Processes a fstab line
voidFind_Actual_Block_Device();// Determines the correct block device and stores it in Actual_Block_Device
protected:
boolProcess_Flags(stringFlags,boolDisplay_Error);// Process custom fstab flags
boolIs_File_System(stringFile_System);// Checks to see if the file system given is considered a file system
boolIs_Image(stringFile_System);// Checks to see if the file system given is considered an image
voidSetup_File_System(boolDisplay_Error);// Sets defaults for a file system partition
voidSetup_Image(boolDisplay_Error);// Sets defaults for an image partition
voidSetup_AndSec(void);// Sets up .android_secure settings
voidFind_Real_Block_Device(string&Block_Device,boolDisplay_Error);// Checks the block device given and follows symlinks until it gets to the real block device
boolFind_Partition_Size();// Finds the partition size from /proc/partitions
unsignedlonglongGet_Size_Via_du(stringPath,boolDisplay_Error);// Uses du to get sizes
boolWipe_EXT23(stringFile_System);// Formats as ext3 or ext2
boolWipe_EXT4();// Formats using ext4, uses make_ext4fs when present
boolWipe_FAT();// Formats as FAT if mkdosfs exits otherwise rm -rf wipe
boolWipe_EXFAT();// Formats as EXFAT
boolWipe_MTD();// Formats as yaffs2 for MTD memory types
boolWipe_RMRF();// Uses rm -rf to wipe
boolWipe_Data_Without_Wiping_Media();// Uses rm -rf to wipe but does not wipe /data/media
boolBackup_Tar(stringbackup_folder);// Backs up using tar for file systems
boolBackup_DD(stringbackup_folder);// Backs up using dd for emmc memory types
boolBackup_Dump_Image(stringbackup_folder);// Backs up using dump_image for MTD memory types
boolRestore_Tar(stringrestore_folder,stringRestore_File_System);// Restore using tar for file systems
boolRestore_DD(stringrestore_folder);// Restore using dd for emmc memory types
boolRestore_Flash_Image(stringrestore_folder);// Restore using flash_image for MTD memory types
boolGet_Size_Via_statfs(boolDisplay_Error);// Get Partition size, used, and free space using statfs
boolGet_Size_Via_df(boolDisplay_Error);// Get Partition size, used, and free space using df command
boolMake_Dir(stringPath,boolDisplay_Error);// Creates a directory if it doesn't already exist
boolFind_MTD_Block_Device(stringMTD_Name);// Finds the mtd block device based on the name from the fstab
voidRecreate_AndSec_Folder(void);// Recreates the .android_secure folder
voidMount_Storage_Retry(void);// Tries multiple times with a half second delay to mount a device in case storage is slow to mount
private:
boolCan_Be_Mounted;// Indicates that the partition can be mounted
boolCan_Be_Wiped;// Indicates that the partition can be wiped
boolCan_Be_Backed_Up;// Indicates that the partition will show up in the backup list
@@ -125,36 +153,6 @@ protected:
stringEcryptFS_Password;// Have to store the encryption password to remount
#endif
private:
boolProcess_Flags(stringFlags,boolDisplay_Error);// Process custom fstab flags
boolIs_File_System(stringFile_System);// Checks to see if the file system given is considered a file system
boolIs_Image(stringFile_System);// Checks to see if the file system given is considered an image
voidSetup_File_System(boolDisplay_Error);// Sets defaults for a file system partition
voidSetup_Image(boolDisplay_Error);// Sets defaults for an image partition
voidSetup_AndSec(void);// Sets up .android_secure settings
voidFind_Real_Block_Device(string&Block_Device,boolDisplay_Error);// Checks the block device given and follows symlinks until it gets to the real block device
boolFind_Partition_Size();// Finds the partition size from /proc/partitions
unsignedlonglongGet_Size_Via_du(stringPath,boolDisplay_Error);// Uses du to get sizes
boolWipe_EXT23(stringFile_System);// Formats as ext3 or ext2
boolWipe_EXT4();// Formats using ext4, uses make_ext4fs when present
boolWipe_FAT();// Formats as FAT if mkdosfs exits otherwise rm -rf wipe
boolWipe_EXFAT();// Formats as EXFAT
boolWipe_MTD();// Formats as yaffs2 for MTD memory types
boolWipe_RMRF();// Uses rm -rf to wipe
boolWipe_Data_Without_Wiping_Media();// Uses rm -rf to wipe but does not wipe /data/media
boolBackup_Tar(stringbackup_folder);// Backs up using tar for file systems
boolBackup_DD(stringbackup_folder);// Backs up using dd for emmc memory types
boolBackup_Dump_Image(stringbackup_folder);// Backs up using dump_image for MTD memory types
boolRestore_Tar(stringrestore_folder,stringRestore_File_System);// Restore using tar for file systems
boolRestore_DD(stringrestore_folder);// Restore using dd for emmc memory types
boolRestore_Flash_Image(stringrestore_folder);// Restore using flash_image for MTD memory types
boolGet_Size_Via_statfs(boolDisplay_Error);// Get Partition size, used, and free space using statfs
boolGet_Size_Via_df(boolDisplay_Error);// Get Partition size, used, and free space using df command
boolMake_Dir(stringPath,boolDisplay_Error);// Creates a directory if it doesn't already exist
boolFind_MTD_Block_Device(stringMTD_Name);// Finds the mtd block device based on the name from the fstab
voidRecreate_AndSec_Folder(void);// Recreates the .android_secure folder
voidMount_Storage_Retry(void);// Tries multiple times with a half second delay to mount a device in case storage is slow to mount
friendclassTWPartitionManager;
friendclassDataManager;
friendclassGUIPartitionList;
@@ -164,53 +162,53 @@ class TWPartitionManager
{
public:
TWPartitionManager(){}
virtual~TWPartitionManager(){}
~TWPartitionManager(){}
public:
virtualintProcess_Fstab(stringFstab_Filename,boolDisplay_Error);// Parses the fstab and populates the partitions
virtualintWrite_Fstab();// Creates /etc/fstab file that's used by the command line for mount commands
virtualvoidOutput_Partition_Logging();// Outputs partition information to the log
virtualintMount_By_Path(stringPath,boolDisplay_Error);// Mounts partition based on path (e.g. /system)
virtualintMount_By_Block(stringBlock,boolDisplay_Error);// Mounts partition based on block device (e.g. /dev/block/mmcblk1p1)
virtualintMount_By_Name(stringName,boolDisplay_Error);// Mounts partition based on display name (e.g. System)
virtualintUnMount_By_Path(stringPath,boolDisplay_Error);// Unmounts partition based on path
virtualintUnMount_By_Block(stringBlock,boolDisplay_Error);// Unmounts partition based on block device
virtualintUnMount_By_Name(stringName,boolDisplay_Error);// Unmounts partition based on display name
virtualintIs_Mounted_By_Path(stringPath);// Checks if partition is mounted based on path
virtualintIs_Mounted_By_Block(stringBlock);// Checks if partition is mounted based on block device
virtualintIs_Mounted_By_Name(stringName);// Checks if partition is mounted based on display name
virtualintMount_Current_Storage(boolDisplay_Error);// Mounts the current storage location
virtualintMount_Settings_Storage(boolDisplay_Error);// Mounts the settings file storage location (usually internal)
intProcess_Fstab(stringFstab_Filename,boolDisplay_Error);// Parses the fstab and populates the partitions
intWrite_Fstab();// Creates /etc/fstab file that's used by the command line for mount commands
voidOutput_Partition_Logging();// Outputs partition information to the log
intMount_By_Path(stringPath,boolDisplay_Error);// Mounts partition based on path (e.g. /system)
intMount_By_Block(stringBlock,boolDisplay_Error);// Mounts partition based on block device (e.g. /dev/block/mmcblk1p1)
intMount_By_Name(stringName,boolDisplay_Error);// Mounts partition based on display name (e.g. System)
intUnMount_By_Path(stringPath,boolDisplay_Error);// Unmounts partition based on path
intUnMount_By_Block(stringBlock,boolDisplay_Error);// Unmounts partition based on block device
intUnMount_By_Name(stringName,boolDisplay_Error);// Unmounts partition based on display name
intIs_Mounted_By_Path(stringPath);// Checks if partition is mounted based on path
intIs_Mounted_By_Block(stringBlock);// Checks if partition is mounted based on block device
intIs_Mounted_By_Name(stringName);// Checks if partition is mounted based on display name
intMount_Current_Storage(boolDisplay_Error);// Mounts the current storage location
intMount_Settings_Storage(boolDisplay_Error);// Mounts the settings file storage location (usually internal)
TWPartition*Find_Partition_By_Path(stringPath);// Returns a pointer to a partition based on path
TWPartition*Find_Partition_By_Block(stringBlock);// Returns a pointer to a partition based on block device
TWPartition*Find_Partition_By_Name(stringBlock);// Returns a pointer to a partition based on name
virtualintCheck_Backup_Name(boolDisplay_Error);// Checks the current backup name to ensure that it is valid
virtualintRun_Backup();// Initiates a backup in the current storage
virtualintRun_Restore(stringRestore_Name);// Restores a backup
virtualvoidSet_Restore_Files(stringRestore_Name);// Used to gather a list of available backup partitions for the user to select for a restore
virtualintWipe_By_Path(stringPath);// Wipes a partition based on path
virtualintWipe_By_Block(stringBlock);// Wipes a partition based on block device
virtualintWipe_By_Name(stringName);// Wipes a partition based on display name
virtualintFactory_Reset();// Performs a factory reset