From: Christian Storm <
christi...@siemens.com>
Remove the superfluous rootCount variable as it is identical to index.
Move the number of handles INFO message (handleCount) inline into
the enumeration INFO messages as "Volume ${index+1}/${handleCount}".
Signed-off-by: Christian Storm <
christi...@siemens.com>
---
utils.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/utils.c b/utils.c
index ace4689..fbd6411 100644
--- a/utils.c
+++ b/utils.c
@@ -106,7 +106,7 @@ EFI_STATUS get_volumes(VOLUME_DESC **volumes, UINTN *count)
EFI_HANDLE *handles = NULL;
EFI_GUID sfspGuid = SIMPLE_FILE_SYSTEM_PROTOCOL;
UINTN handleCount = 0;
- UINTN index, rootCount = 0;
+ UINTN index = 0;
EFI_FILE_HANDLE tmp;
@@ -121,7 +121,6 @@ EFI_STATUS get_volumes(VOLUME_DESC **volumes, UINTN *count)
ERROR(L"Could not locate handle buffer.\n");
return EFI_OUT_OF_RESOURCES;
}
- INFO(L"Found %d handles for file IO\n\n", handleCount);
*volumes = (VOLUME_DESC *)AllocatePool(sizeof(VOLUME_DESC) * handleCount);
if (!*volumes) {
@@ -156,25 +155,23 @@ EFI_STATUS get_volumes(VOLUME_DESC **volumes, UINTN *count)
}
devpathstr = DevicePathToStr(devpath);
- (*volumes)[rootCount].root = tmp;
- (*volumes)[rootCount].devpath = devpath;
- (*volumes)[rootCount].fslabel =
- get_volume_label((*volumes)[rootCount].root);
- (*volumes)[rootCount].fscustomlabel =
- get_volume_custom_label((*volumes)[rootCount].root);
- INFO(L"Volume %d: ", rootCount);
+ (*volumes)[index].root = tmp;
+ (*volumes)[index].devpath = devpath;
+ (*volumes)[index].fslabel =
+ get_volume_label((*volumes)[index].root);
+ (*volumes)[index].fscustomlabel =
+ get_volume_custom_label((*volumes)[index].root);
+ INFO(L"Volume %d/%d: ", index+1, handleCount);
if (IsOnBootMedium(devpath)) {
PrintC(EFI_LIGHTGRAY, L"(On boot medium) ");
}
PrintC(EFI_LIGHTGRAY, L"%s, LABEL=%s, CLABEL=%s\n",
- devpathstr, (*volumes)[rootCount].fslabel,
- (*volumes)[rootCount].fscustomlabel);
+ devpathstr, (*volumes)[index].fslabel,
+ (*volumes)[index].fscustomlabel);
FreePool(devpathstr);
-
- rootCount++;
}
- *count = rootCount;
+ *count = index;
return EFI_SUCCESS;
}
--
2.30.0