]>
git.proxmox.com Git - efi-boot-shim.git/blob - errlog.c
1 // SPDX-License-Identifier: BSD-2-Clause-Patent
4 * Copyright Peter Jones <pjones@redhat.com>
9 static CHAR16
**errs
= NULL
;
10 static UINTN nerrs
= 0;
13 vdprint_(const CHAR16
*fmt
, const char *file
, int line
, const char *func
,
17 EFI_STATUS efi_status
= EFI_SUCCESS
;
20 ms_va_copy(args2
, args
);
21 console_print(L
"%a:%d:%a() ", file
, line
, func
);
22 efi_status
= VPrint(fmt
, args2
);
29 VLogError(const char *file
, int line
, const char *func
, const CHAR16
*fmt
,
35 if (file
== NULL
|| func
== NULL
|| fmt
== NULL
)
36 return EFI_INVALID_PARAMETER
;
38 newerrs
= ReallocatePool(errs
, (nerrs
+ 1) * sizeof(*errs
),
39 (nerrs
+ 3) * sizeof(*errs
));
41 return EFI_OUT_OF_RESOURCES
;
43 newerrs
[nerrs
] = PoolPrint(L
"%a:%d %a() ", file
, line
, func
);
45 return EFI_OUT_OF_RESOURCES
;
46 ms_va_copy(args2
, args
);
47 newerrs
[nerrs
+1] = VPoolPrint(fmt
, args2
);
48 if (!newerrs
[nerrs
+1])
49 return EFI_OUT_OF_RESOURCES
;
53 newerrs
[nerrs
] = NULL
;
60 LogError_(const char *file
, int line
, const char *func
, const CHAR16
*fmt
, ...)
63 EFI_STATUS efi_status
;
65 ms_va_start(args
, fmt
);
66 efi_status
= VLogError(file
, line
, func
, fmt
, args
);
73 LogHexdump_(const char *file
, int line
, const char *func
, const void *data
, size_t sz
)
75 hexdumpat(file
, line
, func
, data
, sz
, 0);
86 for (i
= 0; i
< nerrs
; i
++)
87 console_print(L
"%s", errs
[i
]);
95 for (i
= 0; i
< nerrs
; i
++)
102 // vim:fenc=utf-8:tw=75