partition: add support dm_use_original_path
* On some mediatek devices we must use symlinked path instead of the
real block device. Needed for decryption on some MTK HW FDE devices.
Change-Id: Ib48d745fd442c590aea2baf6d2dbe20aaaef9eec
This commit is contained in:
+10
-1
@@ -161,6 +161,7 @@ enum TW_FSTAB_FLAGS {
|
||||
TWFLAG_KEYDIRECTORY,
|
||||
TWFLAG_WRAPPEDKEY,
|
||||
TWFLAG_ADOPTED_MOUNT_DELAY,
|
||||
TWFLAG_DM_USE_ORIGINAL_PATH,
|
||||
};
|
||||
|
||||
/* Flags without a trailing '=' are considered dual format flags and can be
|
||||
@@ -206,6 +207,7 @@ const struct flag_list tw_flags[] = {
|
||||
{ "keydirectory=", TWFLAG_KEYDIRECTORY },
|
||||
{ "wrappedkey", TWFLAG_WRAPPEDKEY },
|
||||
{ "adopted_mount_delay=", TWFLAG_ADOPTED_MOUNT_DELAY },
|
||||
{ "dm_use_original_path", TWFLAG_DM_USE_ORIGINAL_PATH },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
@@ -271,6 +273,8 @@ TWPartition::TWPartition() {
|
||||
Key_Directory = "";
|
||||
Is_Super = false;
|
||||
Adopted_Mount_Delay = 0;
|
||||
Original_Path = "";
|
||||
Use_Original_Path = false;
|
||||
}
|
||||
|
||||
TWPartition::~TWPartition(void) {
|
||||
@@ -670,7 +674,7 @@ void TWPartition::Setup_Data_Partition(bool Display_Error) {
|
||||
} else if (!Mount(false)) {
|
||||
if (Is_Present) {
|
||||
if (Key_Directory.empty()) {
|
||||
set_partition_data(Actual_Block_Device.c_str(), Crypto_Key_Location.c_str(),
|
||||
set_partition_data(Use_Original_Path ? Original_Path.c_str() : Actual_Block_Device.c_str(), Crypto_Key_Location.c_str(),
|
||||
Fstab_File_System.c_str());
|
||||
if (cryptfs_check_footer() == 0) {
|
||||
Is_Encrypted = true;
|
||||
@@ -1015,6 +1019,9 @@ void TWPartition::Apply_TW_Flag(const unsigned flag, const char* str, const bool
|
||||
case TWFLAG_KEYDIRECTORY:
|
||||
Key_Directory = str;
|
||||
break;
|
||||
case TWFLAG_DM_USE_ORIGINAL_PATH:
|
||||
Use_Original_Path = true;
|
||||
break;
|
||||
default:
|
||||
// Should not get here
|
||||
LOGINFO("Flag identified for processing, but later unmatched: %i\n", flag);
|
||||
@@ -1227,6 +1234,8 @@ void TWPartition::Setup_Data_Media() {
|
||||
void TWPartition::Find_Real_Block_Device(string& Block, bool Display_Error) {
|
||||
char device[PATH_MAX], realDevice[PATH_MAX];
|
||||
|
||||
Original_Path = Block;
|
||||
|
||||
strcpy(device, Block.c_str());
|
||||
memset(realDevice, 0, sizeof(realDevice));
|
||||
while (readlink(device, realDevice, sizeof(realDevice)) > 0)
|
||||
|
||||
Reference in New Issue
Block a user