super processing: use logical flag to denote super status
To support all partitions that are on the super partition we now parse for the logical flag in fstab to denote super status. - Remove guards for the first character being '/'. - Skip commented lines in fstab - Build Backup_Display_Name from partitions in super. The first four lines that are in fstab will be displayed. Change-Id: I3f8980187bd4a136257dd6eeaeddd7ea71706cd3 Change-Id: I1ee7c02f91aafb646beaf401a43bcb22fa8c8c7a
This commit is contained in:
+13
-21
@@ -162,6 +162,7 @@ enum TW_FSTAB_FLAGS {
|
||||
TWFLAG_WRAPPEDKEY,
|
||||
TWFLAG_ADOPTED_MOUNT_DELAY,
|
||||
TWFLAG_DM_USE_ORIGINAL_PATH,
|
||||
TWFLAG_LOGICAL,
|
||||
};
|
||||
|
||||
/* Flags without a trailing '=' are considered dual format flags and can be
|
||||
@@ -208,6 +209,7 @@ const struct flag_list tw_flags[] = {
|
||||
{ "wrappedkey", TWFLAG_WRAPPEDKEY },
|
||||
{ "adopted_mount_delay=", TWFLAG_ADOPTED_MOUNT_DELAY },
|
||||
{ "dm_use_original_path", TWFLAG_DM_USE_ORIGINAL_PATH },
|
||||
{ "logical", TWFLAG_LOGICAL },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
@@ -301,6 +303,9 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error,
|
||||
}
|
||||
if (line_len < 10)
|
||||
return false; // There can't possibly be a valid fstab line that is less than 10 chars
|
||||
if (fstab_line[0] == '#')
|
||||
return false; // skip comments
|
||||
|
||||
if (strncmp(fstab_line, "/dev/", strlen("/dev/")) == 0 || strncmp(fstab_line, "/devices/", strlen("/devices/")) == 0) {
|
||||
fstab_version = 2;
|
||||
block_device_index = 0;
|
||||
@@ -308,8 +313,7 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error,
|
||||
fs_index = 2;
|
||||
}
|
||||
|
||||
Is_Super = PartitionManager.Is_Super_Partition(fstab_line);
|
||||
if (Is_Super) {
|
||||
if (fstab_line[0] != '/') {
|
||||
block_device_index = 0;
|
||||
fstab_version = 2;
|
||||
mount_point_index = 1;
|
||||
@@ -356,17 +360,10 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error,
|
||||
Primary_Block_Device = ptr;
|
||||
if (*ptr != '/')
|
||||
LOGERR("Until we get better BML support, you will have to find and provide the full block device path to the BML devices e.g. /dev/block/bml9 instead of the partition name\n");
|
||||
} else if (*ptr != '/') {
|
||||
if (!Is_Super) {
|
||||
if (Display_Error)
|
||||
LOGERR("Invalid block device '%s' in fstab line '%s'", ptr, fstab_line);
|
||||
else
|
||||
LOGINFO("Invalid block device '%s' in fstab line '%s'", ptr, fstab_line);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
Primary_Block_Device = ptr;
|
||||
Find_Real_Block_Device(Primary_Block_Device, Display_Error);
|
||||
if (*ptr == '/')
|
||||
Find_Real_Block_Device(Primary_Block_Device, Display_Error);
|
||||
}
|
||||
item_index++;
|
||||
} else if (item_index > 2) {
|
||||
@@ -1026,6 +1023,9 @@ void TWPartition::Apply_TW_Flag(const unsigned flag, const char* str, const bool
|
||||
case TWFLAG_DM_USE_ORIGINAL_PATH:
|
||||
Use_Original_Path = true;
|
||||
break;
|
||||
case TWFLAG_LOGICAL:
|
||||
Is_Super = true;
|
||||
break;
|
||||
default:
|
||||
// Should not get here
|
||||
LOGINFO("Flag identified for processing, but later unmatched: %i\n", flag);
|
||||
@@ -1248,16 +1248,8 @@ void TWPartition::Find_Real_Block_Device(string& Block, bool Display_Error) {
|
||||
memset(realDevice, 0, sizeof(realDevice));
|
||||
}
|
||||
|
||||
if (device[0] != '/') {
|
||||
if (Display_Error)
|
||||
LOGERR("Invalid symlink path '%s' found on block device '%s'\n", device, Block.c_str());
|
||||
else
|
||||
LOGINFO("Invalid symlink path '%s' found on block device '%s'\n", device, Block.c_str());
|
||||
return;
|
||||
} else {
|
||||
Block = device;
|
||||
return;
|
||||
}
|
||||
Block = device;
|
||||
return;
|
||||
}
|
||||
|
||||
bool TWPartition::Mount_Storage_Retry(bool Display_Error) {
|
||||
|
||||
Reference in New Issue
Block a user