Skip to content
Advertisement

How to avoid quotes (“…”) in shortcut-ed printk Macros inside Linux Kernel Modules

I have created a set of shortcut Macros for Linux Kernel printk to prefix with the module name and to have a set of aliases for severity.

JavaScript

Using those Macros like this:

JavaScript

Now the issue is that the final output in the Kernel Ring Buffer get quoted in the following way:

JavaScript

Do you have any idea of how to avoid having this extra quotes?

For the full files please take a look at the Header and the Source File.

Thank you very much for your time and looking forward to a possible solution.

Advertisement

Answer

You have an additional # in the macro replacement. Just remove it – format is supposed to be a string already:

JavaScript

For prepending some values in kernel the pr_fmt macro was meant to be used, like here or here or basically examples everywhere.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement