Rust: how to implement file_operations for a misc device?

Fabio development at redaril.me
Tue Sep 23 12:47:25 EDT 2025


Hello,

brand-new kernel newbie here. I'm interested in the Rust side of the 
kernel. To get acquainted, I'm following the Linux Driver Development 
book, 3rd edition, also integrating it with modern documentation and 
best practices (or at least I hope so).

I'm developing the scull module on top of the 
`kernel::miscdevice::MiscDevice` trait. Where I'm stuck at is the lack 
of the `kernel::file::Operations` trait [1], that most online resources 
refer to. I need such trait to implement read and write operations for 
the misc device. AFAIU, this trait used to exist but it's no longer in 
the mainline codebase [2]. Also, `kernel::miscdevice::MiscdeviceVTable` 
is private inside the miscdevice module, so there's no way I can somehow 
extend it.

Is there any workaround for what I want to achieve, or is ioctl the only 
allowed interface to misc devices in Rust?

Thank you,
Fabio.

[^1]: 
https://rust-for-linux.github.io/docs/kernel/file/trait.Operations.html
[^2]: https://rust.docs.kernel.org/kernel/fs/index.html





More information about the Kernelnewbies mailing list