From 5971b59e8bb6676f34b5a785bcc23c763666ffc6 Mon Sep 17 00:00:00 2001 From: Simon Kuenzer Date: Wed, 31 May 2023 17:44:18 +0200 Subject: [PATCH] lib/ukdebug: Use lib/uklibid for library names Every invocation of any of the provided print function macros by `lib/ukdebug` (`uk_printk()`, `uk_printd()`), caused placing a C-string containing the library name in the sources. This commit replaces this C-string with a library identifier which is just an unsigned integer. The ID is only resolved into a name in the actual print format function (`_vprint()`). The resolution is done by `uk_libname()` that is using the ID for a table lookup (O(1)). Signed-off-by: Simon Kuenzer Reviewed-by: Michalis Pappas Reviewed-by: Robert Kuban Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #938 --- lib/syscall_shim/include/uk/syscall.h | 2 +- lib/syscall_shim/uk_syscall_binary.c | 2 +- lib/ukdebug/Config.uk | 1 + lib/ukdebug/asmdump.c | 16 +++++++------- lib/ukdebug/hexdump.c | 8 +++---- lib/ukdebug/include/uk/asmdump.h | 17 ++++++++------- lib/ukdebug/include/uk/hexdump.h | 9 ++++---- lib/ukdebug/include/uk/print.h | 31 +++++++++++---------------- lib/ukdebug/outf.c | 4 ++-- lib/ukdebug/outf.h | 11 +++++----- lib/ukdebug/print.c | 27 ++++++++++++----------- lib/uklibid/Config.uk | 8 ++++++- lib/uktest/include/uk/test.h | 2 +- lib/uktest/test.c | 12 +++++------ 14 files changed, 78 insertions(+), 72 deletions(-) diff --git a/lib/syscall_shim/include/uk/syscall.h b/lib/syscall_shim/include/uk/syscall.h index 279c31ffd..0cedc135e 100644 --- a/lib/syscall_shim/include/uk/syscall.h +++ b/lib/syscall_shim/include/uk/syscall.h @@ -208,7 +208,7 @@ typedef long uk_syscall_arg_t; #define UK_S_ARG_FMT_LONGX(type, arg) "(" STRINGIFY(type) ") 0x%lx" #define __UK_SYSCALL_PRINTD(x, rtype, fname, ...) \ - _uk_printd(__STR_LIBNAME__, __STR_BASENAME__, __LINE__, \ + _uk_printd(uk_libid_self(), __STR_BASENAME__, __LINE__, \ "(" STRINGIFY(rtype) ") " STRINGIFY(fname) \ "(" UK_ARG_FMT_MAPx(x, UK_S_ARG_FMT_LONGX, __VA_ARGS__) ")\n" \ UK_ARG_EMAPx(x, UK_S_ARG_CAST_LONG, __VA_ARGS__) ) diff --git a/lib/syscall_shim/uk_syscall_binary.c b/lib/syscall_shim/uk_syscall_binary.c index 0c81e1e6c..f257e8890 100644 --- a/lib/syscall_shim/uk_syscall_binary.c +++ b/lib/syscall_shim/uk_syscall_binary.c @@ -86,7 +86,7 @@ void ukplat_syscall_handler(struct __regs *r) _uk_syscall_return_addr = r->rip; #if CONFIG_LIBSYSCALL_SHIM_DEBUG_HANDLER - _uk_printd(__STR_LIBNAME__, __STR_BASENAME__, __LINE__, + _uk_printd(uk_libid_self(), __STR_BASENAME__, __LINE__, "Binary system call request \"%s\" (%lu) at ip:%p (arg0=0x%lx, arg1=0x%lx, ...)\n", uk_syscall_name(r->rsyscall), r->rsyscall, (void *) r->rip, r->rarg0, r->rarg1); diff --git a/lib/ukdebug/Config.uk b/lib/ukdebug/Config.uk index 5fad9db4d..072927a6b 100644 --- a/lib/ukdebug/Config.uk +++ b/lib/ukdebug/Config.uk @@ -1,6 +1,7 @@ menuconfig LIBUKDEBUG bool "ukdebug: Debugging and tracing" depends on (HAVE_LIBC || LIBNOLIBC) + select LIBUKLIBID default y if LIBUKDEBUG diff --git a/lib/ukdebug/asmdump.c b/lib/ukdebug/asmdump.c index 18bc17907..105dd80e7 100644 --- a/lib/ukdebug/asmdump.c +++ b/lib/ukdebug/asmdump.c @@ -151,44 +151,44 @@ static int _asmndump(struct out_dev *o, #error No supported disassembler backend available. #endif /* CONFIG_LIBZYDIS */ -void _uk_asmdumpd(const char *libname, const char *srcname, +void _uk_asmdumpd(__u16 libid, const char *srcname, unsigned int srcline, const void *instr, unsigned int instr_count) { struct out_dev o; - out_dev_init_debug(&o, libname, srcname, srcline); + out_dev_init_debug(&o, libid, srcname, srcline); _asmdump(&o, instr, instr_count); } -void _uk_asmndumpd(const char *libname, const char *srcname, +void _uk_asmndumpd(__u16 libid, const char *srcname, unsigned int srcline, const void *instr, size_t len) { struct out_dev o; - out_dev_init_debug(&o, libname, srcname, srcline); + out_dev_init_debug(&o, libid, srcname, srcline); _asmndump(&o, instr, len); } #if CONFIG_LIBUKDEBUG_PRINTK -void _uk_asmdumpk(int lvl, const char *libname, +void _uk_asmdumpk(int lvl, __u16 libid, const char *srcname, unsigned int srcline, const void *instr, unsigned int instr_count) { struct out_dev o; - out_dev_init_kern(&o, lvl, libname, srcname, srcline); + out_dev_init_kern(&o, lvl, libid, srcname, srcline); _asmdump(&o, instr, instr_count); } -void _uk_asmndumpk(int lvl, const char *libname, +void _uk_asmndumpk(int lvl, __u16 libid, const char *srcname, unsigned int srcline, const void *instr, size_t len) { struct out_dev o; - out_dev_init_kern(&o, lvl, libname, srcname, srcline); + out_dev_init_kern(&o, lvl, libid, srcname, srcline); _asmndump(&o, instr, len); } #endif /* CONFIG_LIBUKDEBUG_PRINTK */ diff --git a/lib/ukdebug/hexdump.c b/lib/ukdebug/hexdump.c index 696db6948..21a588529 100644 --- a/lib/ukdebug/hexdump.c +++ b/lib/ukdebug/hexdump.c @@ -241,26 +241,26 @@ int uk_hexdumpf(FILE *fp, const void *data, size_t len, size_t addr0, int flags, return _hxd(&o, data, len, addr0, flags, grps_per_line, line_prefix); } -void _uk_hexdumpd(const char *libname, const char *srcname, +void _uk_hexdumpd(__u16 libid, const char *srcname, unsigned int srcline, const void *data, size_t len, size_t addr0, int flags, unsigned int grps_per_line, const char *line_prefix) { struct out_dev o; - out_dev_init_debug(&o, libname, srcname, srcline); + out_dev_init_debug(&o, libid, srcname, srcline); _hxd(&o, data, len, addr0, flags, grps_per_line, line_prefix); } #if CONFIG_LIBUKDEBUG_PRINTK -void _uk_hexdumpk(int lvl, const char *libname, const char *srcname, +void _uk_hexdumpk(int lvl, __u16 libid, const char *srcname, unsigned int srcline, const void *data, size_t len, size_t addr0, int flags, unsigned int grps_per_line, const char *line_prefix) { struct out_dev o; - out_dev_init_kern(&o, lvl, libname, srcname, srcline); + out_dev_init_kern(&o, lvl, libid, srcname, srcline); _hxd(&o, data, len, addr0, flags, grps_per_line, line_prefix); } #endif diff --git a/lib/ukdebug/include/uk/asmdump.h b/lib/ukdebug/include/uk/asmdump.h index 4161b2064..323308b5b 100644 --- a/lib/ukdebug/include/uk/asmdump.h +++ b/lib/ukdebug/include/uk/asmdump.h @@ -45,6 +45,7 @@ */ #include +#include #include #ifdef __cplusplus @@ -74,20 +75,20 @@ extern "C" { #if (defined UK_DEBUG) || CONFIG_LIBUKDEBUG_PRINTD /* Please use uk_asmdumpd() instead */ -void _uk_asmdumpd(const char *libname, const char *srcname, +void _uk_asmdumpd(__u16 libid, const char *srcname, unsigned int srcline, const void *instr, unsigned int instr_count); #define uk_asmdumpd(instr, instr_count) \ - _uk_asmdumpd(__STR_LIBNAME__, __STR_BASENAME__, \ + _uk_asmdumpd(uk_libid_self(), __STR_BASENAME__, \ __LINE__, (instr), (instr_count)) -void _uk_asmndumpd(const char *libname, const char *srcname, +void _uk_asmndumpd(__u16 libid, const char *srcname, unsigned int srcline, const void *instr, size_t len); #define uk_asmndumpd(instr, len) \ - _uk_asmndumpd(__STR_LIBNAME__, __STR_BASENAME__, \ + _uk_asmndumpd(uk_libid_self(), __STR_BASENAME__, \ __LINE__, (instr), (len)) #else /* (defined UK_DEBUG) || CONFIG_LIBUKDEBUG_PRINTD */ static inline void uk_asmdumpd(const void *instr __unused, @@ -101,25 +102,25 @@ static inline void uk_asmndumpd(const void *instr __unused, #if CONFIG_LIBUKDEBUG_PRINTK /* Please use uk_asmdumpk() instead */ -void _uk_asmdumpk(int lvl, const char *libname, const char *srcname, +void _uk_asmdumpk(int lvl, __u16 libid, const char *srcname, unsigned int srcline, const void *instr, unsigned int instr_count); #define uk_asmdumpk(lvl, instr, instr_count) \ do { \ if ((lvl) <= KLVL_MAX) \ - _uk_asmdumpk((lvl), __STR_LIBNAME__, __STR_BASENAME__, \ + _uk_asmdumpk((lvl), uk_libid_self(), __STR_BASENAME__, \ __LINE__, (instr), (instr_count)); \ } while (0) -void _uk_asmndumpk(int lvl, const char *libname, const char *srcname, +void _uk_asmndumpk(int lvl, __u16 libid, const char *srcname, unsigned int srcline, const void *instr, size_t len); #define uk_asmndumpk(lvl, instr, len) \ do { \ if ((lvl) <= KLVL_MAX) \ - _uk_asmdumpk((lvl), __STR_LIBNAME__, __STR_BASENAME__, \ + _uk_asmdumpk((lvl), uk_libid_self(), __STR_BASENAME__, \ __LINE__, (instr), (len)); \ } while (0) #else /* CONFIG_LIBUKDEBUG_PRINTK */ diff --git a/lib/ukdebug/include/uk/hexdump.h b/lib/ukdebug/include/uk/hexdump.h index 676ae8da7..07add7923 100644 --- a/lib/ukdebug/include/uk/hexdump.h +++ b/lib/ukdebug/include/uk/hexdump.h @@ -37,6 +37,7 @@ #define __UKDEBUG_HEXDUMP_H__ #include +#include #include #ifdef __cplusplus @@ -71,7 +72,7 @@ extern "C" { #if (defined UK_DEBUG) || CONFIG_LIBUKDEBUG_PRINTD /* Please use uk_hexdumpd() instead */ -void _uk_hexdumpd(const char *libname, const char *srcname, +void _uk_hexdumpd(__u16 libid, const char *srcname, unsigned int srcline, const void *data, size_t len, size_t addr0, int flags, unsigned int grps_per_line, const char *line_prefix); @@ -89,7 +90,7 @@ void _uk_hexdumpd(const char *libname, const char *srcname, * @return Returns the number of printed characters to output fp */ #define uk_hexdumpd(data, len, flags, grps_per_line) \ - _uk_hexdumpd(__STR_LIBNAME__, __STR_BASENAME__, \ + _uk_hexdumpd(uk_libid_self(), __STR_BASENAME__, \ __LINE__, (data), (len), \ ((size_t)(data)), (flags), \ (grps_per_line), STRINGIFY(data) ": ") @@ -102,7 +103,7 @@ static inline void uk_hexdumpd(const void *data __unused, size_t len __unused, #if CONFIG_LIBUKDEBUG_PRINTK /* Please use uk_hexdumpk() instead */ -void _uk_hexdumpk(int lvl, const char *libname, const char *srcname, +void _uk_hexdumpk(int lvl, __u16 libid, const char *srcname, unsigned int srcline, const void *data, size_t len, size_t addr0, int flags, unsigned int grps_per_line, const char *line_prefix); @@ -122,7 +123,7 @@ void _uk_hexdumpk(int lvl, const char *libname, const char *srcname, #define uk_hexdumpk(lvl, data, len, flags, grps_per_line) \ do { \ if ((lvl) <= KLVL_MAX) \ - _uk_hexdumpk((lvl), __STR_LIBNAME__, __STR_BASENAME__, \ + _uk_hexdumpk((lvl), uk_libid_self(), __STR_BASENAME__, \ __LINE__, (data), (len), \ ((size_t)(data)), (flags), \ (grps_per_line), STRINGIFY(data) ": "); \ diff --git a/lib/ukdebug/include/uk/print.h b/lib/ukdebug/include/uk/print.h index d04b2cfd1..72978cc35 100644 --- a/lib/ukdebug/include/uk/print.h +++ b/lib/ukdebug/include/uk/print.h @@ -37,6 +37,7 @@ #define __UKDEBUG_PRINT_H__ #include +#include #include #include #include @@ -45,12 +46,6 @@ extern "C" { #endif -#ifdef __LIBNAME__ -#define __STR_LIBNAME__ STRINGIFY(__LIBNAME__) -#else -#define __STR_LIBNAME__ (NULL) -#endif - #ifdef __BASENAME__ #define __STR_BASENAME__ STRINGIFY(__BASENAME__) #else @@ -64,9 +59,9 @@ extern "C" { * by other libraries with an own debug print switch * (e.g., hexdump, syscall_shim) */ -void _uk_vprintd(const char *libname, const char *srcname, +void _uk_vprintd(__u16 libid, const char *srcname, unsigned int srcline, const char *fmt, va_list ap); -void _uk_printd(const char *libname, const char *srcname, +void _uk_printd(__u16 libid, const char *srcname, unsigned int srcline, const char *fmt, ...) __printf(4, 5); #ifdef __IN_LIBUKDEBUG__ @@ -84,7 +79,7 @@ void _uk_printd(const char *libname, const char *srcname, #if defined UK_DEBUG || CONFIG_LIBUKDEBUG_PRINTD #define uk_vprintd(fmt, ap) \ do { \ - _uk_vprintd(__STR_LIBNAME__, __STR_BASENAME__, \ + _uk_vprintd(uk_libid_self(), __STR_BASENAME__, \ __LINE__, (fmt), ap); \ } while (0) @@ -92,7 +87,7 @@ void _uk_printd(const char *libname, const char *srcname, do { \ static int __x; \ if (unlikely(!__x)) { \ - _uk_vprintd(__STR_LIBNAME__, __STR_BASENAME__, \ + _uk_vprintd(uk_libid_self(), __STR_BASENAME__, \ __LINE__, (fmt), ap); \ __x = 1; \ } \ @@ -100,7 +95,7 @@ void _uk_printd(const char *libname, const char *srcname, #define uk_printd(fmt, ...) \ do { \ - _uk_printd(__STR_LIBNAME__, __STR_BASENAME__, \ + _uk_printd(uk_libid_self(), __STR_BASENAME__, \ __LINE__, (fmt), ##__VA_ARGS__); \ } while (0) @@ -108,7 +103,7 @@ void _uk_printd(const char *libname, const char *srcname, do { \ static int __x; \ if (unlikely(!__x)) { \ - _uk_printd(__STR_LIBNAME__, __STR_BASENAME__, \ + _uk_printd(uk_libid_self(), __STR_BASENAME__, \ __LINE__, (fmt), ##__VA_ARGS__); \ __x = 1; \ } \ @@ -155,15 +150,15 @@ static inline void uk_printd_once(const char *fmt __unused, ...) * they compile in the function calls only if the configured * debug level requires it */ -void _uk_vprintk(int lvl, const char *libname, const char *srcname, +void _uk_vprintk(int lvl, __u16 libid, const char *srcname, unsigned int srcline, const char *fmt, va_list ap); -void _uk_printk(int lvl, const char *libname, const char *srcname, +void _uk_printk(int lvl, __u16 libid, const char *srcname, unsigned int srcline, const char *fmt, ...) __printf(5, 6); #define uk_vprintk(lvl, fmt, ap) \ do { \ if ((lvl) <= KLVL_MAX) \ - _uk_vprintk((lvl), __STR_LIBNAME__, __STR_BASENAME__, \ + _uk_vprintk((lvl), uk_libid_self(), __STR_BASENAME__, \ __LINE__, (fmt), ap); \ } while (0) @@ -172,7 +167,7 @@ void _uk_printk(int lvl, const char *libname, const char *srcname, if ((lvl) <= KLVL_MAX) { \ static int __x; \ if (unlikely(!__x)) { \ - _uk_vprintk((lvl), __STR_LIBNAME__, \ + _uk_vprintk((lvl), uk_libid_self(), \ __STR_BASENAME__, \ __LINE__, (fmt), ap); \ __x = 1; \ @@ -183,7 +178,7 @@ void _uk_printk(int lvl, const char *libname, const char *srcname, #define uk_printk(lvl, fmt, ...) \ do { \ if ((lvl) <= KLVL_MAX) \ - _uk_printk((lvl), __STR_LIBNAME__, __STR_BASENAME__, \ + _uk_printk((lvl), uk_libid_self(), __STR_BASENAME__, \ __LINE__, (fmt), ##__VA_ARGS__); \ } while (0) @@ -192,7 +187,7 @@ void _uk_printk(int lvl, const char *libname, const char *srcname, if ((lvl) <= KLVL_MAX) { \ static int __x; \ if (unlikely(!__x)) { \ - _uk_printk((lvl), __STR_LIBNAME__, \ + _uk_printk((lvl), uk_libid_self(), \ __STR_BASENAME__, \ __LINE__, (fmt), ##__VA_ARGS__); \ __x = 1; \ diff --git a/lib/ukdebug/outf.c b/lib/ukdebug/outf.c index c825fc2c7..d882d81ad 100644 --- a/lib/ukdebug/outf.c +++ b/lib/ukdebug/outf.c @@ -64,13 +64,13 @@ int outf(struct out_dev *dev, const char *fmt, ...) } break; case OUTDEV_DEBUG: - _uk_vprintd(dev->uk_pr.libname, + _uk_vprintd(dev->uk_pr.libid, dev->uk_pr.srcname, dev->uk_pr.srcline, fmt, ap); break; #if CONFIG_LIBUKDEBUG_PRINTK case OUTDEV_KERN: - _uk_vprintk(dev->uk_pr.lvl, dev->uk_pr.libname, + _uk_vprintk(dev->uk_pr.lvl, dev->uk_pr.libid, dev->uk_pr.srcname, dev->uk_pr.srcline, fmt, ap); break; diff --git a/lib/ukdebug/outf.h b/lib/ukdebug/outf.h index c4cd470d7..32da204a6 100644 --- a/lib/ukdebug/outf.h +++ b/lib/ukdebug/outf.h @@ -39,6 +39,7 @@ #include #include #include +#include enum out_dev_type { OUTDEV_FILE = 0, @@ -56,7 +57,7 @@ struct out_dev { /* OUTDEV_KERN, OUTDEV_DEBUG */ struct { int lvl; /* OUTDEV_KERN only */ - const char *libname; + __u16 libid; const char *srcname; unsigned int srcline; } uk_pr; @@ -93,20 +94,20 @@ int outf(struct out_dev *dev, const char *fmt, ...); } while (0) #if CONFIG_LIBUKDEBUG_PRINTK -#define out_dev_init_kern(dev, lvl, libname, srcname, srcline) \ +#define out_dev_init_kern(dev, lvl, libid, srcname, srcline) \ do { \ (dev)->type = OUTDEV_KERN; \ (dev)->uk_pr.lvl = (lvl); \ - (dev)->uk_pr.libname = (libname); \ + (dev)->uk_pr.libid = (libid); \ (dev)->uk_pr.srcname = (srcname); \ (dev)->uk_pr.srcline = (srcline); \ } while (0) #endif -#define out_dev_init_debug(dev, libname, srcname, srcline) \ +#define out_dev_init_debug(dev, libid, srcname, srcline) \ do { \ (dev)->type = OUTDEV_DEBUG; \ - (dev)->uk_pr.libname = (libname); \ + (dev)->uk_pr.libid = (libid); \ (dev)->uk_pr.srcname = (srcname); \ (dev)->uk_pr.srcline = (srcline); \ } while (0) diff --git a/lib/ukdebug/print.c b/lib/ukdebug/print.c index 38cb60b83..482f168ef 100644 --- a/lib/ukdebug/print.c +++ b/lib/ukdebug/print.c @@ -168,7 +168,7 @@ static void _print_caller(struct _vprint_console *cons, __uptr ra, __uptr fa) #endif /* CONFIG_LIBUKDEBUG_PRINT_CALLER */ static void _vprint(struct _vprint_console *cons, - int lvl, const char *libname, + int lvl, __u16 libid, #if CONFIG_LIBUKDEBUG_PRINT_SRCNAME const char *srcname, unsigned int srcline, @@ -184,6 +184,7 @@ static void _vprint(struct _vprint_console *cons, const char *msghdr = NULL; const char *lptr = NULL; const char *nlptr = NULL; + const char *libname = uk_libname(libid); /* * Note: We reset the console colors earlier in order to exclude @@ -311,37 +312,37 @@ static void _vprint(struct _vprint_console *cons, #define _VPRINT_ARGS_CALLER() #endif /* CONFIG_LIBUKDEBUG_PRINT_CALLER */ -void _uk_vprintd(const char *libname, const char *srcname __maybe_unused, +void _uk_vprintd(__u16 libid, const char *srcname __maybe_unused, unsigned int srcline __maybe_unused, const char *fmt, va_list ap) { #if CONFIG_LIBUKDEBUG_REDIR_PRINTD - _vprint(&kern, KLVL_DEBUG, libname, + _vprint(&kern, KLVL_DEBUG, libid, _VPRINT_ARGS_SRCNAME(srcname, srcline) _VPRINT_ARGS_CALLER() fmt, ap); #else - _vprint(&debug, KLVL_DEBUG, libname, + _vprint(&debug, KLVL_DEBUG, libid, _VPRINT_ARGS_SRCNAME(srcname, srcline) _VPRINT_ARGS_CALLER() fmt, ap); #endif /* !CONFIG_LIBUKDEBUG_REDIR_PRINTD */ } -void _uk_printd(const char *libname, const char *srcname __maybe_unused, +void _uk_printd(__u16 libid, const char *srcname __maybe_unused, unsigned int srcline __maybe_unused, const char *fmt, ...) { va_list ap; va_start(ap, fmt); #if CONFIG_LIBUKDEBUG_REDIR_PRINTD - _vprint(&kern, KLVL_DEBUG, libname, + _vprint(&kern, KLVL_DEBUG, libid, _VPRINT_ARGS_SRCNAME(srcname, srcline) _VPRINT_ARGS_CALLER() fmt, ap); #else - _vprint(&debug, KLVL_DEBUG, libname, + _vprint(&debug, KLVL_DEBUG, libid, _VPRINT_ARGS_SRCNAME(srcname, srcline) _VPRINT_ARGS_CALLER() fmt, ap); @@ -356,25 +357,25 @@ void _uk_printd(const char *libname, const char *srcname __maybe_unused, * enabled. */ #if CONFIG_LIBUKDEBUG_PRINTK -void _uk_vprintk(int lvl, const char *libname, +void _uk_vprintk(int lvl, __u16 libid, const char *srcname __maybe_unused, unsigned int srcline __maybe_unused, const char *fmt, va_list ap) { #if CONFIG_LIBUKDEBUG_REDIR_PRINTK - _vprint(&debug, lvl, libname, + _vprint(&debug, lvl, libid, _VPRINT_ARGS_SRCNAME(srcname, srcline) _VPRINT_ARGS_CALLER() fmt, ap); #else - _vprint(&kern, lvl, libname, + _vprint(&kern, lvl, libid, _VPRINT_ARGS_SRCNAME(srcname, srcline) _VPRINT_ARGS_CALLER() fmt, ap); #endif /* !CONFIG_LIBUKDEBUG_REDIR_PRINTK */ } -void _uk_printk(int lvl, const char *libname, +void _uk_printk(int lvl, __u16 libid, const char *srcname __maybe_unused, unsigned int srcline __maybe_unused, const char *fmt, ...) @@ -383,12 +384,12 @@ void _uk_printk(int lvl, const char *libname, va_start(ap, fmt); #if CONFIG_LIBUKDEBUG_REDIR_PRINTK - _vprint(&debug, lvl, libname, + _vprint(&debug, lvl, libid, _VPRINT_ARGS_SRCNAME(srcname, srcline) _VPRINT_ARGS_CALLER() fmt, ap); #else - _vprint(&kern, lvl, libname, + _vprint(&kern, lvl, libid, _VPRINT_ARGS_SRCNAME(srcname, srcline) _VPRINT_ARGS_CALLER() fmt, ap); diff --git a/lib/uklibid/Config.uk b/lib/uklibid/Config.uk index 7100ef684..059757d6f 100644 --- a/lib/uklibid/Config.uk +++ b/lib/uklibid/Config.uk @@ -1,4 +1,10 @@ config LIBUKLIBID bool "uklibid: Library identifier" default n - select LIBUKDEBUG + # FIXME: We actually depend on but lib/ukdebug also + # depends on us. If we specify the dependency here, it creates a + # circular dependency that KConfig doesn't like. However, we + # can currently assume that lib/ukdebug is always part of a + # build, so we comment out the dependency here. Of course, this + # is not accurate. + #select LIBUKDEBUG diff --git a/lib/uktest/include/uk/test.h b/lib/uktest/include/uk/test.h index aad957111..5bbdfc91d 100644 --- a/lib/uktest/include/uk/test.h +++ b/lib/uktest/include/uk/test.h @@ -200,7 +200,7 @@ /* Custom print method. */ #define uk_test_printf(fmt, ...) \ - _uk_printk(KLVL_INFO, __NULL, __NULL, 0x0, \ + _uk_printk(KLVL_INFO, UKLIBID_NONE, __NULL, 0x0, \ "\t" fmt, ##__VA_ARGS__) diff --git a/lib/uktest/test.c b/lib/uktest/test.c index e6415c067..9f1e1e2bb 100644 --- a/lib/uktest/test.c +++ b/lib/uktest/test.c @@ -178,14 +178,14 @@ uk_testsuite_run(struct uk_testsuite *suite) #endif /* CONFIG_LIBUKTEST_LOG_STATS */ #ifdef CONFIG_LIBUKTEST_LOG_TESTS - _uk_printk(KLVL_INFO, __NULL, __NULL, 0x0, - (LVLC_TESTNAME "test:" UK_ANSI_MOD_RESET - " %s->%s"), suite->name, esac->name); + _uk_printk(KLVL_INFO, UKLIBID_NONE, __NULL, 0x0, + (LVLC_TESTNAME "test:" UK_ANSI_MOD_RESET + " %s->%s"), suite->name, esac->name); if (esac->desc != NULL) - _uk_printk(KLVL_INFO, __NULL, __NULL, 0x0, ": %s\n", - esac->desc); + _uk_printk(KLVL_INFO, UKLIBID_NONE, __NULL, 0x0, + ": %s\n", esac->desc); else - _uk_printk(KLVL_INFO, __NULL, __NULL, 0x0, "\n"); + _uk_printk(KLVL_INFO, UKLIBID_NONE, __NULL, 0x0, "\n"); #endif /* CONFIG_LIBUKTEST_LOG_TESTS */ esac->func(esac); -- 2.39.5