The patch titled Subject: lib/dynamic_debug.c: introduce accessors for string members of struct _ddebug has been added to the -mm tree. Its filename is dynamic_debug-introduce-accessors-for-string-members-of-struct-_ddebug.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/dynamic_debug-introduce-accessors-for-string-members-of-struct-_ddebug.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/dynamic_debug-introduce-accessors-for-string-members-of-struct-_ddebug.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Subject: lib/dynamic_debug.c: introduce accessors for string members of struct _ddebug When we introduce compact versions of these pointers (a la CONFIG_GENERIC_BUG_RELATIVE_POINTERS), all access to these members must go via appropriate accessors. This just mass-converts dynamic_debug.c to use the new accessors. Link: http://lkml.kernel.org/r/20190409212517.7321-5-linux@xxxxxxxxxxxxxxxxxx Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Acked-by: Jason Baron <jbaron@xxxxxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxx> Cc: David Miller <davem@xxxxxxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Paul Mackerras <paulus@xxxxxxxxx> Cc: Petr Mladek <pmladek@xxxxxxxx> Cc: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/dynamic_debug.c | 51 ++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 17 deletions(-) --- a/lib/dynamic_debug.c~dynamic_debug-introduce-accessors-for-string-members-of-struct-_ddebug +++ a/lib/dynamic_debug.c @@ -37,6 +37,23 @@ #include <linux/device.h> #include <linux/netdevice.h> +static inline const char *dd_modname(const struct _ddebug *dd) +{ + return dd->modname; +} +static inline const char *dd_function(const struct _ddebug *dd) +{ + return dd->function; +} +static inline const char *dd_filename(const struct _ddebug *dd) +{ + return dd->filename; +} +static inline const char *dd_format(const struct _ddebug *dd) +{ + return dd->format; +} + extern struct _ddebug __start___verbose[]; extern struct _ddebug __stop___verbose[]; @@ -158,21 +175,21 @@ static int ddebug_change(const struct dd /* match against the source filename */ if (query->filename && - !match_wildcard(query->filename, dp->filename) && + !match_wildcard(query->filename, dd_filename(dp)) && !match_wildcard(query->filename, - kbasename(dp->filename)) && + kbasename(dd_filename(dp))) && !match_wildcard(query->filename, - trim_prefix(dp->filename))) + trim_prefix(dd_filename(dp)))) continue; /* match against the function */ if (query->function && - !match_wildcard(query->function, dp->function)) + !match_wildcard(query->function, dd_function(dp))) continue; /* match against the format */ if (query->format && - !strstr(dp->format, query->format)) + !strstr(dd_format(dp), query->format)) continue; /* match against the line number range */ @@ -197,8 +214,8 @@ static int ddebug_change(const struct dd #endif dp->flags = newflags; vpr_info("changed %s:%d [%s]%s =%s\n", - trim_prefix(dp->filename), dp->lineno, - dt->mod_name, dp->function, + trim_prefix(dd_filename(dp)), dp->lineno, + dt->mod_name, dd_function(dp), ddebug_describe_flags(dp, flagbuf, sizeof(flagbuf))); } @@ -533,10 +550,10 @@ static char *dynamic_emit_prefix(const s pos_after_tid = pos; if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME) pos += snprintf(buf + pos, remaining(pos), "%s:", - desc->modname); + dd_modname(desc)); if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) pos += snprintf(buf + pos, remaining(pos), "%s:", - desc->function); + dd_function(desc)); if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO) pos += snprintf(buf + pos, remaining(pos), "%d:", desc->lineno); @@ -790,10 +807,10 @@ static int ddebug_proc_show(struct seq_f } seq_printf(m, "%s:%u [%s]%s =%s \"", - trim_prefix(dp->filename), dp->lineno, - iter->table->mod_name, dp->function, + trim_prefix(dd_filename(dp)), dp->lineno, + iter->table->mod_name, dd_function(dp), ddebug_describe_flags(dp, flagsbuf, sizeof(flagsbuf))); - seq_escape(m, dp->format, "\t\r\n\""); + seq_escape(m, dd_format(dp), "\t\r\n\""); seq_puts(m, "\"\n"); return 0; @@ -987,20 +1004,20 @@ static int __init dynamic_debug_init(voi return 1; } iter = __start___verbose; - modname = iter->modname; + modname = dd_modname(iter); iter_start = iter; for (; iter < __stop___verbose; iter++) { entries++; - verbose_bytes += strlen(iter->modname) + strlen(iter->function) - + strlen(iter->filename) + strlen(iter->format); + verbose_bytes += strlen(dd_modname(iter)) + strlen(dd_function(iter)) + + strlen(dd_filename(iter)) + strlen(dd_format(iter)); - if (strcmp(modname, iter->modname)) { + if (strcmp(modname, dd_modname(iter))) { modct++; ret = ddebug_add_module(iter_start, n, modname); if (ret) goto out_err; n = 0; - modname = iter->modname; + modname = dd_modname(iter); iter_start = iter; } n++; _ Patches currently in -mm which might be from linux@xxxxxxxxxxxxxxxxxx are linux-deviceh-use-unique-identifier-for-each-struct-_ddebug.patch linux-neth-use-unique-identifier-for-each-struct-_ddebug.patch linux-printkh-use-unique-identifier-for-each-struct-_ddebug.patch dynamic_debug-introduce-accessors-for-string-members-of-struct-_ddebug.patch dynamic_debug-drop-use-of-bitfields-in-struct-_ddebug.patch dynamic_debug-introduce-config_dynamic_debug_relative_pointers.patch dynamic_debug-add-asm-generic-implementation-for-dynamic_debug_relative_pointers.patch x86-64-select-dynamic_debug_relative_pointers.patch arm64-select-dynamic_debug_relative_pointers.patch powerpc-select-dynamic_debug_relative_pointers-for-ppc64.patch lib-bitmapc-remove-unused-export_symbols.patch lib-bitmapc-guard-exotic-bitmap-functions-by-config_numa.patch bitopsh-sanitize-rotate-primitives.patch