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

Implement support for custom printk formats #269

@geofft

Description

@geofft

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....)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions