shim: make everything use a common perror() call.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2017-10-19 15:57:32 -04:00 committed by Peter Jones
parent 568dc4944f
commit dd712378a7
5 changed files with 17 additions and 30 deletions

View File

@ -7,10 +7,6 @@
#include "shim.h"
#ifdef LogError
#undef LogError
#endif
static CHAR16 **errs = NULL;
static UINTN nerrs = 0;
@ -51,7 +47,7 @@ VLogError(const char *file, int line, const char *func, CHAR16 *fmt, va_list arg
}
EFI_STATUS
LogError(const char *file, int line, const char *func, CHAR16 *fmt, ...)
LogError_(const char *file, int line, const char *func, CHAR16 *fmt, ...)
{
va_list args;
EFI_STATUS efi_status;

View File

@ -36,13 +36,6 @@
#include "shim.h"
#define perror(fmt, ...) ({ \
UINTN __perror_ret = 0; \
if (!in_protocol) \
__perror_ret = Print((fmt), ##__VA_ARGS__); \
__perror_ret; \
})
static UINTN
ascii_to_int (CONST CHAR8 *str)
{

8
shim.c
View File

@ -65,14 +65,6 @@ static CHAR16 *second_stage;
static void *load_options;
static UINT32 load_options_size;
#define perror(fmt, ...) ({ \
UINTN __perror_ret = 0; \
if (!in_protocol) \
__perror_ret = Print((fmt), ##__VA_ARGS__); \
LogError(fmt, ##__VA_ARGS__); \
__perror_ret; \
})
/*
* The vendor certificate used for validating the second stage loader
*/

18
shim.h
View File

@ -156,11 +156,25 @@ typedef struct _SHIM_LOCK {
extern EFI_STATUS shim_init(void);
extern void shim_fini(void);
extern EFI_STATUS LogError(const char *file, int line, const char *func, CHAR16 *fmt, ...);
extern EFI_STATUS LogError_(const char *file, int line, const char *func, CHAR16 *fmt, ...);
extern EFI_STATUS VLogError(const char *file, int line, const char *func, CHAR16 *fmt, va_list args);
extern VOID PrintErrors(VOID);
extern VOID ClearErrors(VOID);
#define LogError(fmt, ...) LogError(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
extern UINT32 vendor_cert_size;
extern UINT32 vendor_dbx_size;
extern UINT8 *vendor_cert;
extern UINT8 *vendor_dbx;
extern UINT8 in_protocol;
#define perror_(file, line, func, fmt, ...) ({ \
UINTN __perror_ret = 0; \
if (!in_protocol) \
__perror_ret = Print((fmt), ##__VA_ARGS__); \
LogError_(file, line, func, fmt, ##__VA_ARGS__); \
__perror_ret; \
})
#define perror(fmt, ...) perror_(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
#define LogError(fmt, ...) LogError_(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
#endif /* SHIM_H_ */

8
tpm.c
View File

@ -5,14 +5,6 @@
#include "shim.h"
#define perror(fmt, ...) ({ \
UINTN __perror_ret = 0; \
if (!in_protocol) \
__perror_ret = Print((fmt), ##__VA_ARGS__); \
__perror_ret; \
})
typedef struct {
CHAR16 *VariableName;
EFI_GUID *VendorGuid;