Re: [PATCH v4 2/3] rust: miscdevice: add additional data to MiscDeviceRegistration

From: Benno Lossin
Date: Sat Jun 07 2025 - 11:37:28 EST


On Sat Jun 7, 2025 at 1:34 PM CEST, Christian Schrefl wrote:
> Yeah I understand that its not UB, but to me it seems a bit fragile and opaque why it is allowed.
> That's what I meant by "a bit iffy".

What's fragile about it? That someone could add a non-opaque field to
the struct? Or that one is not allowed to take an `&`?

> Alright but I doubt that realistic, since the `Data` would always at
> least be shared between the owner of `MiscDeviceRegistration` and the
> `fops` implementation. Meaning its always shared with syscall context
> and I don't think it makes sense to have a registration owed in
> that context.

That might be the case, but I think we should have this as a general
design guideline: avoid unnecessary trait bounds.

---
Cheers,
Benno