-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support per-device context for chrdev
#604
Comments
I've taken a look at implementing this feature but it's currently made tricky b/c of #207. The linked PR (effectively) made I've racked my brain for a bit but I can't think of any tricks from rust side to derive a context value without a I'm considering sending out a RFC to lkml about adding a |
I've sent out an RFC: https://lore.kernel.org/lkml/[email protected]/ |
Some evidence beyond faith of the usefulness of a context: the Binder code uses it (https://github.com/Rust-for-Linux/linux/blob/rust/drivers/android/process.rs#L810) to hold some state that is shared by all files that share a device. It isn't a global because we can have more than one device (each with several files), and globals should generally be avoided anyway. |
What do you need this for? The upstream maintainer of |
I'm rewriting some of the examples from LDD3 in rust as a fun exercise. Thought I could shake out a few bugs / missing features in rust-for-linux along the way too. LDD3 uses cdev so I thought I'd stick to the original recipe.
Oh, in that case I'll just use miscdev. Didn't know they were interchangeable. |
Currently,
miscdev::Registration::new
andmiscdev::Registration::new_pinned
both support taking a context to be passed to theFileOpener::open
trait method. We'll take it on faith it's useful (IMO it is).chrdev
does not have this support yet. I think it'd make sense to add a context param tochrdev::Registration::register
(as opposed tonew
andnew_pinned
) b/c the samechrdev::Registration
can be used to register multiple cdevs (as opposed tomiscdev
which can only register one).The text was updated successfully, but these errors were encountered: