diff options
author | Tom Rini <trini@konsulko.com> | 2025-01-26 08:10:28 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-01-26 08:10:28 -0600 |
commit | 8a2a71a4eec7afdca6377ee46b1ed7e78ec692c9 (patch) | |
tree | 460b9a426fc254b7fd9f4048dabccfb54822ba02 /common/log.c | |
parent | 292278d6828e6c8c6ae11bc8658586d1acc411d4 (diff) | |
parent | 21de624eb89c647a21b06a5b0f5b186838be1d17 (diff) |
Merge tag 'efi-2025-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2025-04-rc1-2
Documentation:
* describe creating a pflash file for qemu-system-riscv64
UEFI:
* correct logging StartImage()
* use LOGC_EFI consistently
* reduce UEFI size if HAS_BOARD_SIZE_LIMIT=y
* Update efi_run_image() to accept image and device path
* Add a version of efi_binary_run() with more parameters
* Move the fallback code from efi_run_image()
* Pass in the required parameters from EFI bootmeth
* bootmeth_efi: Support PXE booting
Other:
* Enable log filtering by function name
Diffstat (limited to 'common/log.c')
-rw-r--r-- | common/log.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/common/log.c b/common/log.c index c9fe35230d6..b75e404420b 100644 --- a/common/log.c +++ b/common/log.c @@ -130,17 +130,25 @@ bool log_has_cat(enum log_category_t cat_list[], enum log_category_t cat) return false; } -bool log_has_file(const char *file_list, const char *file) +/** + * log_has_member() - check if a string is in a comma separated list + * + * @list: Comma separated list of strings + * @member: String to find + * + * Return: ``true`` if @member is in @list, else ``false`` + */ +static bool log_has_member(const char *list, const char *member) { - int file_len = strlen(file); + int member_len = strlen(member); const char *s, *p; int substr_len; - for (s = file_list; *s; s = p + (*p != '\0')) { + for (s = list; *s; s = p + (*p != '\0')) { p = strchrnul(s, ','); substr_len = p - s; - if (file_len >= substr_len && - !strncmp(file + file_len - substr_len, s, substr_len)) + if (member_len >= substr_len && + !strncmp(member + member_len - substr_len, s, substr_len)) return true; } @@ -181,7 +189,11 @@ static bool log_passes_filters(struct log_device *ldev, struct log_rec *rec) continue; if (filt->file_list && - !log_has_file(filt->file_list, rec->file)) + !log_has_member(filt->file_list, rec->file)) + continue; + + if (filt->func_list && + !log_has_member(filt->func_list, rec->func)) continue; if (filt->flags & LOGFF_DENY) @@ -321,7 +333,7 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level, int log_add_filter_flags(const char *drv_name, enum log_category_t cat_list[], enum log_level_t level, const char *file_list, - int flags) + const char *func_list, int flags) { struct log_filter *filt; struct log_device *ldev; @@ -356,6 +368,13 @@ int log_add_filter_flags(const char *drv_name, enum log_category_t cat_list[], goto err; } } + if (func_list) { + filt->func_list = strdup(func_list); + if (!filt->func_list) { + ret = -ENOMEM; + goto err; + } + } filt->filter_num = ldev->next_filter_num++; /* Add deny filters to the beginning of the list */ if (flags & LOGFF_DENY) |