]>
git.proxmox.com Git - efi-boot-shim.git/blob - errlog.c
3 * Copyright 2017 Peter Jones <pjones@redhat.com>
5 * Distributed under terms of the GPLv3 license.
10 static CHAR16
**errs
= NULL
;
11 static UINTN nerrs
= 0;
14 VLogError(const char *file
, int line
, const char *func
, CHAR16
*fmt
, va_list args
)
17 UINTN size
= 0, size2
;
20 size
= SPrint(NULL
, 0, L
"%a:%d %a() ", file
, line
, func
);
22 size2
= VSPrint(NULL
, 0, fmt
, args2
);
25 newerrs
= ReallocatePool(errs
, (nerrs
+ 1) * sizeof(*errs
),
26 (nerrs
+ 3) * sizeof(*errs
));
28 return EFI_OUT_OF_RESOURCES
;
30 newerrs
[nerrs
] = AllocatePool(size
*2+2);
32 return EFI_OUT_OF_RESOURCES
;
33 newerrs
[nerrs
+1] = AllocatePool(size2
*2+2);
34 if (!newerrs
[nerrs
+1])
35 return EFI_OUT_OF_RESOURCES
;
37 SPrint(newerrs
[nerrs
], size
*2+2, L
"%a:%d %a() ", file
, line
, func
);
39 VSPrint(newerrs
[nerrs
+1], size2
*2+2, fmt
, args2
);
43 newerrs
[nerrs
] = NULL
;
50 LogError_(const char *file
, int line
, const char *func
, CHAR16
*fmt
, ...)
53 EFI_STATUS efi_status
;
56 efi_status
= VLogError(file
, line
, func
, fmt
, args
);
70 for (i
= 0; i
< nerrs
; i
++)
71 console_print(L
"%s", errs
[i
]);
79 for (i
= 0; i
< nerrs
; i
++)
86 // vim:fenc=utf-8:tw=75