From: Jan Kiszka <[email protected]> This avoids calling IsOnBootMedium multiple times and also allows to make that function private.
Signed-off-by: Jan Kiszka <[email protected]> --- env/syspart.c | 4 ++-- include/utils.h | 2 +- utils.c | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/env/syspart.c b/env/syspart.c index ece7a3f..fba5531 100644 --- a/env/syspart.c +++ b/env/syspart.c @@ -67,7 +67,7 @@ UINTN filter_cfg_parts(UINTN *config_volumes, UINTN numHandles) for (UINTN index = 0; index < numHandles; index++) { VOLUME_DESC *v = &volumes[config_volumes[index]]; - if (IsOnBootMedium(v->devpath)) { + if (v->onbootmedium) { use_envs_on_bootmedium_only = TRUE; }; } @@ -83,7 +83,7 @@ UINTN filter_cfg_parts(UINTN *config_volumes, UINTN numHandles) UINTN cvi = config_volumes[j]; VOLUME_DESC *v = &volumes[cvi]; - if (IsOnBootMedium(v->devpath)) { + if (v->onbootmedium) { swap_uintn(&config_volumes[j], &config_volumes[num_sorted++]); } else { diff --git a/include/utils.h b/include/utils.h index 17bda30..2b4f862 100644 --- a/include/utils.h +++ b/include/utils.h @@ -22,6 +22,7 @@ typedef struct _VOLUME_DESC { EFI_DEVICE_PATH *devpath; + BOOLEAN onbootmedium; CHAR16 *fslabel; CHAR16 *fscustomlabel; EFI_FILE_HANDLE root; @@ -39,7 +40,6 @@ EFI_STATUS close_volumes(VOLUME_DESC *volumes, UINTN count); EFI_DEVICE_PATH *FileDevicePathFromConfig(EFI_HANDLE device, CHAR16 *payloadpath); CHAR16 *GetBootMediumPath(CHAR16 *input); -BOOLEAN IsOnBootMedium(EFI_DEVICE_PATH *dp); typedef EFI_STATUS (*WATCHDOG_PROBE)(EFI_PCI_IO *, UINT16, UINT16, UINTN); #define _CONCAT(prefix, func) prefix ## func diff --git a/utils.c b/utils.c index e7b9175..52bf034 100644 --- a/utils.c +++ b/utils.c @@ -31,7 +31,7 @@ VOID PrintC(const UINT8 color, const CHAR16 *fmt, ...) (VOID) ST->ConOut->SetAttribute(ST->ConOut, attr); } -BOOLEAN IsOnBootMedium(EFI_DEVICE_PATH *dp) +static BOOLEAN IsOnBootMedium(EFI_DEVICE_PATH *dp) { extern CHAR16 *boot_medium_path; CHAR16 *device_path, *tmp; @@ -157,14 +157,17 @@ EFI_STATUS get_volumes(VOLUME_DESC **volumes, UINTN *count) } devpathstr = DevicePathToStr(devpath); + BOOLEAN onbootmedium = IsOnBootMedium(devpath); + (*volumes)[rootCount].root = tmp; (*volumes)[rootCount].devpath = devpath; + (*volumes)[rootCount].onbootmedium = onbootmedium; (*volumes)[rootCount].fslabel = get_volume_label((*volumes)[rootCount].root); (*volumes)[rootCount].fscustomlabel = get_volume_custom_label((*volumes)[rootCount].root); INFO(L"Volume %d: ", rootCount); - if (IsOnBootMedium(devpath)) { + if (onbootmedium) { INFO(L"(On boot medium) "); } INFO(L"%s, LABEL=%s, CLABEL=%s\n", -- 2.43.0 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/efibootguard-dev/0fb31eb608f845c461aa0c272d66998eb4f071d7.1733751547.git.jan.kiszka%40siemens.com.
