diff options
| -rw-r--r-- | fallback.c | 17 | ||||
| -rw-r--r-- | include/compiler.h | 2 | ||||
| -rw-r--r-- | include/console.h | 7 | ||||
| -rw-r--r-- | include/hexdump.h | 8 | ||||
| -rw-r--r-- | mok.c | 17 | ||||
| -rw-r--r-- | shim.c | 6 | ||||
| -rw-r--r-- | shim.h | 6 |
7 files changed, 36 insertions, 27 deletions
@@ -54,14 +54,15 @@ get_fallback_verbose(void) ret_; \ }) -#define VerbosePrint(fmt, ...) \ - ({ UINTN line_ = __LINE__; \ - UINTN ret_ = 0; \ - if (get_fallback_verbose()) { \ - console_print(L"%a:%d: ", __func__, line_); \ - ret_ = console_print((fmt), ##__VA_ARGS__); \ - } \ - ret_; \ +#define VerbosePrint(fmt, ...) \ + ({ \ + UINTN line_ = __LINE__ - 2; \ + UINTN ret_ = 0; \ + if (get_fallback_verbose()) { \ + console_print(L"%a:%d: ", __func__, line_); \ + ret_ = console_print((fmt), ##__VA_ARGS__); \ + } \ + ret_; \ }) static EFI_STATUS diff --git a/include/compiler.h b/include/compiler.h index a2a08593..163b3df2 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -129,7 +129,7 @@ */ #ifndef compiletime_assert #define compiletime_assert(condition, msg) \ - _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) + _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__ - 1) #endif /** diff --git a/include/console.h b/include/console.h index ac6fdf61..b99004c6 100644 --- a/include/console.h +++ b/include/console.h @@ -84,10 +84,13 @@ extern UINT32 verbose; __dprint_ret = console_print((fmt), ##__VA_ARGS__); \ __dprint_ret; \ }) -#define dprint(fmt, ...) dprint_(L"%a:%d:%a() " fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__) +#define dprint(fmt, ...) \ + dprint_(L"%a:%d:%a() " fmt, __FILE__, __LINE__ - 1, __func__, \ + ##__VA_ARGS__) extern EFI_STATUS vdprint_(const CHAR16 *fmt, const char *file, int line, const char *func, va_list args); -#define vdprint(fmt, ...) vdprint_(fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__) +#define vdprint(fmt, ...) \ + vdprint_(fmt, __FILE__, __LINE__ - 1, __func__, ##__VA_ARGS__) extern EFI_STATUS print_crypto_errors(EFI_STATUS rc, char *file, const char *func, int line); #define crypterr(rc) print_crypto_errors((rc), __FILE__, __func__, __LINE__) diff --git a/include/hexdump.h b/include/hexdump.h index b2968cd4..de209ec5 100644 --- a/include/hexdump.h +++ b/include/hexdump.h @@ -135,9 +135,11 @@ hexdumpat(const char *file, int line, const char *func, const void *data, unsign } #define LogHexdump(data, sz) LogHexdump_(__FILE__, __LINE__, __func__, data, sz) -#define dhexdump(data, sz) hexdump(__FILE__, __LINE__, __func__, data, sz) -#define dhexdumpat(data, sz, at) hexdumpat(__FILE__, __LINE__, __func__, data, sz, at) -#define dhexdumpf(fmt, data, sz, at, ...) hexdumpf(__FILE__, __LINE__, __func__, fmt, data, sz, at, ##__VA_ARGS__) +#define dhexdump(data, sz) hexdump(__FILE__, __LINE__, __func__, data, sz) +#define dhexdumpat(data, sz, at) \ + hexdumpat(__FILE__, __LINE__ - 1, __func__, data, sz, at) +#define dhexdumpf(fmt, data, sz, at, ...) \ + hexdumpf(__FILE__, __LINE__ - 1, __func__, fmt, data, sz, at, ##__VA_ARGS__) #endif /* STATIC_HEXDUMP_H */ // vim:fenc=utf-8:tw=75:noet @@ -27,14 +27,15 @@ static BOOLEAN check_var(CHAR16 *varname) return FALSE; } -#define SetVariable(name, guid, attrs, varsz, var) ({ \ - EFI_STATUS efi_status_; \ - efi_status_ = gRT->SetVariable(name, guid, attrs, varsz, var); \ - dprint_(L"%a:%d:%a() SetVariable(\"%s\", ... varsz=0x%llx) = %r\n",\ - __FILE__, __LINE__, __func__, \ - name, varsz, efi_status_); \ - efi_status_; \ -}) +#define SetVariable(name, guid, attrs, varsz, var) \ + ({ \ + EFI_STATUS efi_status_; \ + efi_status_ = gRT->SetVariable(name, guid, attrs, varsz, var); \ + dprint_(L"%a:%d:%a() SetVariable(\"%s\", ... varsz=0x%llx) = %r\n", \ + __FILE__, __LINE__ - 5, __func__, name, varsz, \ + efi_status_); \ + efi_status_; \ + }) /* * If the OS has set any of these variables we need to drop into MOK and @@ -756,7 +756,7 @@ static BOOLEAN secure_mode (void) goto done; \ } \ }) -#define check_size(d,ds,h,hs) check_size_line(d,ds,h,hs,__LINE__) +#define check_size(d, ds, h, hs) check_size_line(d, ds, h, hs, __LINE__) /* * Calculate the SHA1 and SHA256 hashes of a binary @@ -2802,9 +2802,9 @@ efi_main (EFI_HANDLE passed_image_handle, EFI_SYSTEM_TABLE *passed_systab) setup_verbosity(); dprint(L"vendor_authorized:0x%08lx vendor_authorized_size:%lu\n", - __FILE__, __LINE__, __func__, vendor_authorized, vendor_authorized_size); + vendor_authorized, vendor_authorized_size); dprint(L"vendor_deauthorized:0x%08lx vendor_deauthorized_size:%lu\n", - __FILE__, __LINE__, __func__, vendor_deauthorized, vendor_deauthorized_size); + vendor_deauthorized, vendor_deauthorized_size); init_openssl(); /* @@ -212,7 +212,9 @@ extern UINT8 in_protocol; 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__) +#define perror(fmt, ...) \ + perror_(__FILE__, __LINE__ - 1, __func__, fmt, ##__VA_ARGS__) +#define LogError(fmt, ...) \ + LogError_(__FILE__, __LINE__ - 1, __func__, fmt, ##__VA_ARGS__) #endif /* SHIM_H_ */ |
