Linux-Kernel-Internals - Linux Kernel Internals: https://ankitkdev.com/blog/ - Char Driver: https://ankitkdev.com/blog/linux-kernel/device-driver/char-driver/ - Ioctl Interface: https://ankitkdev.com/blog/linux-kernel/device-driver/ioctl/ - Proc-Interface: https://ankitkdev.com/blog/linux-kernel/device-driver/proc/ - Completion-Variable: https://ankitkdev.com/blog/linux-kernel/concurrency/completion-variable/ - container_of(): https://ankitkdev.com/blog/linux-kernel/macros/container_of/ - Module Parameters: https://ankitkdev.com/blog/linux-kernel/macros/kernel-module/ - pr_fmt(): https://ankitkdev.com/blog/linux-kernel/macros/pr-family/ - Stringification: https://ankitkdev.com/blog/linux-kernel/macros/string/ - Debugging Macros: https://ankitkdev.com/blog/linux-kernel/macros/debug/ - Error Handling with Pointers: https://ankitkdev.com/blog/kernal-internals/error-handling/ - Kbuild Makefile: https://ankitkdev.com/blog/kernal-internals/kbuild/ - SLUB debug: https://ankitkdev.com/blog/kernel-debugging/debug-slub-memory/ - unsigned :\ 0 Bit-Fields in c: https://ankitkdev.com/blog/c/zero-width-bit-field/ - do { ... } while (0): https://ankitkdev.com/blog/c/do-while-loop/ - Error Handling: https://ankitkdev.com/blog/c/error-handling/ - C Memory Layout: https://ankitkdev.com/blog/c/c-memory-layout/ - Forward Declarations: https://ankitkdev.com/blog/c/forward-declaration-in-c/ - Return value by Macro: https://ankitkdev.com/blog/c/return-by-macro/ - Variadic Macro: https://ankitkdev.com/blog/c/variadic-macro/ - programming concepts: https://ankitkdev.com/blog/theory/ - Build & Install Linux Kernel for BBB: https://ankitkdev.com/blog/misc/build-linux-kernel-BBB/ - Configure U-boot for BBB: https://ankitkdev.com/blog/misc/configure-uboot-bbb/ - Install Ubuntu Server on Qemu: https://ankitkdev.com/blog/misc/install-ubuntu-server-on-qemu/ - Linux Kernel Mentorship Program: https://ankitkdev.com/blog/misc/linux-kernel-mentorship-program/ ## Stringification `include/linux/stringify.h` defines: ```c #define __stringify_1(x...) #x #define __stringify(x...) __stringify_1(x) ``` Both use `#` to turn an argument into a string literal. They differ only when the argument is a macro. `#` stringifies tokens *before* expanding any macros in them. So `__stringify_1(x)` gives you the literal text you passed, macro name included, unexpanded. `__stringify(x)` adds one layer of indirection. Since `x` isn't touched directly by `#` inside `__stringify`, the preprocessor expands `x` first when it's passed down to `__stringify_1`, which then stringifies the *expanded* result. Example: ```c #define KVERSION 6 pr_info("%s\n", __stringify_1(KVERSION)); // "KVERSION" pr_info("%s\n", __stringify(KVERSION)); // "6" char *hello = "world"; pr_info("%s\n", __stringify_1(hello)); // "hello" pr_info("%s\n", __stringify(hello)); // "hello" ``` For a non-macro token: a variable name, a plain string, there's nothing to expand, so both macros produce the same output. > **Note**: The indirection only work when the argument is a `#define`.