There's a question to ponder regarding the versatile printk kernel API, how will you ensure that your printk output looks correct (is correctly formatted) and works equally well on any CPU regardless of bit width? The portability issue raises its head here; the good news is that getting familiar with the various format specifiers provided will help you a great deal in this regard, in effect allowing you to write arch-independent printks.
It's important to realize that the size_t - pronounced size type - is a typedef for an unsigned integer; similarly, ssize_t (signed size type) is a typedef for a signed integer.
Here's a few top-of-mind common printk format specifiers to keep in mind when writing portable code:
- For size_t, ssize_t (signed and unsigned) integers : use %zd and %zu respectively
- Kernel pointers: use...