|
@@ -1399,10 +1399,11 @@ ShellCommandCreateInitialMappingsAndPaths (
|
|
|
CHAR16 *MapName;
|
|
|
SHELL_MAP_LIST *MapListItem;
|
|
|
|
|
|
- SplitCurDir = NULL;
|
|
|
- MapName = NULL;
|
|
|
- MapListItem = NULL;
|
|
|
- HandleList = NULL;
|
|
|
+ ConsistMappingTable = NULL;
|
|
|
+ SplitCurDir = NULL;
|
|
|
+ MapName = NULL;
|
|
|
+ MapListItem = NULL;
|
|
|
+ HandleList = NULL;
|
|
|
|
|
|
//
|
|
|
// Reset the static members back to zero
|
|
@@ -1458,32 +1459,35 @@ ShellCommandCreateInitialMappingsAndPaths (
|
|
|
//
|
|
|
PerformQuickSort (DevicePathList, Count, sizeof (EFI_DEVICE_PATH_PROTOCOL *), DevicePathCompare);
|
|
|
|
|
|
- ShellCommandConsistMappingInitialize (&ConsistMappingTable);
|
|
|
- //
|
|
|
- // Assign new Mappings to all...
|
|
|
- //
|
|
|
- for (Count = 0; HandleList[Count] != NULL; Count++) {
|
|
|
- //
|
|
|
- // Get default name first
|
|
|
- //
|
|
|
- NewDefaultName = ShellCommandCreateNewMappingName (MappingTypeFileSystem);
|
|
|
- ASSERT (NewDefaultName != NULL);
|
|
|
- Status = ShellCommandAddMapItemAndUpdatePath (NewDefaultName, DevicePathList[Count], 0, TRUE);
|
|
|
- ASSERT_EFI_ERROR (Status);
|
|
|
- FreePool (NewDefaultName);
|
|
|
-
|
|
|
+ if (!EFI_ERROR (ShellCommandConsistMappingInitialize (&ConsistMappingTable))) {
|
|
|
//
|
|
|
- // Now do consistent name
|
|
|
+ // Assign new Mappings to all...
|
|
|
//
|
|
|
- NewConsistName = ShellCommandConsistMappingGenMappingName (DevicePathList[Count], ConsistMappingTable);
|
|
|
- if (NewConsistName != NULL) {
|
|
|
- Status = ShellCommandAddMapItemAndUpdatePath (NewConsistName, DevicePathList[Count], 0, FALSE);
|
|
|
+ for (Count = 0; HandleList[Count] != NULL; Count++) {
|
|
|
+ //
|
|
|
+ // Get default name first
|
|
|
+ //
|
|
|
+ NewDefaultName = ShellCommandCreateNewMappingName (MappingTypeFileSystem);
|
|
|
+ ASSERT (NewDefaultName != NULL);
|
|
|
+ Status = ShellCommandAddMapItemAndUpdatePath (NewDefaultName, DevicePathList[Count], 0, TRUE);
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
- FreePool (NewConsistName);
|
|
|
+ FreePool (NewDefaultName);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Now do consistent name
|
|
|
+ //
|
|
|
+ NewConsistName = ShellCommandConsistMappingGenMappingName (DevicePathList[Count], ConsistMappingTable);
|
|
|
+ if (NewConsistName != NULL) {
|
|
|
+ Status = ShellCommandAddMapItemAndUpdatePath (NewConsistName, DevicePathList[Count], 0, FALSE);
|
|
|
+ ASSERT_EFI_ERROR (Status);
|
|
|
+ FreePool (NewConsistName);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- ShellCommandConsistMappingUnInitialize (ConsistMappingTable);
|
|
|
+ if (ConsistMappingTable != NULL) {
|
|
|
+ ShellCommandConsistMappingUnInitialize (ConsistMappingTable);
|
|
|
+ }
|
|
|
|
|
|
SHELL_FREE_NON_NULL (HandleList);
|
|
|
SHELL_FREE_NON_NULL (DevicePathList);
|
|
@@ -1626,12 +1630,12 @@ ShellCommandUpdateMapping (
|
|
|
//
|
|
|
PerformQuickSort (DevicePathList, Count, sizeof (EFI_DEVICE_PATH_PROTOCOL *), DevicePathCompare);
|
|
|
|
|
|
- ShellCommandConsistMappingInitialize (&ConsistMappingTable);
|
|
|
+ Status = ShellCommandConsistMappingInitialize (&ConsistMappingTable);
|
|
|
|
|
|
//
|
|
|
// Assign new Mappings to remainders
|
|
|
//
|
|
|
- for (Count = 0; !EFI_ERROR (Status) && HandleList[Count] != NULL && !EFI_ERROR (Status); Count++) {
|
|
|
+ for (Count = 0; !EFI_ERROR (Status) && HandleList[Count] != NULL; Count++) {
|
|
|
//
|
|
|
// Skip ones that already have
|
|
|
//
|