Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Implement support for custom printk formats #269

Open
geofft opened this issue Aug 30, 2020 · 0 comments
Open

Implement support for custom printk formats #269

geofft opened this issue Aug 30, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@geofft
Copy link
Collaborator

geofft commented Aug 30, 2020

A couple folks asked about this at Plumbers. printk supports format specifiers for various kernel types: https://www.kernel.org/doc/Documentation/printk-formats.txt

For instance, %pd will print the path of a struct dentry (by walking its parents), and %pD will print the path of a struct file.

It'd be nice to support those in Rust, probably through impl Display. We should reuse the existing code to format it, somehow.

There's also some unique behavior around printing pointers: %p hashes the pointer before printing it (so equal pointers display equal, but they don't leak kernel memory layout), and %pK will possibly print zero depending on kptr_restrict. You need %px to deliberately print a pointer. I'm not sure how to match that behavior. (I don't think we have any use cases for printing pointers yet, at all....)

@alex alex added the enhancement New feature or request label Aug 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants