Re: [PATCH v2 1/2] rust: introduce abstractions for fwctlg

From: Zhi Wang

Date: Wed Jan 28 2026 - 12:32:08 EST


On Wed, 28 Jan 2026 17:35:04 +0100
"Danilo Krummrich" <dakr@xxxxxxxxxx> wrote:

> On Wed Jan 28, 2026 at 4:56 PM CET, Jason Gunthorpe wrote:
> > On Wed, Jan 28, 2026 at 04:49:07PM +0100, Danilo Krummrich wrote:

snip

> > Or is it needed to add the typestate?
>
> This is something we should consider when a fwctl::Device would have
> different states it can be in, where calling certain methods of a
> fwctl::Device is only valid for a certain state and would cause
> undefined behavior if called from the wrong state.

Are you saying we should define typestate like Device<Bound/Core> also for
fwctl device? I haven't thought about this and some design consideration
would be helpful, as the rust PCI subsystem has it, while some of other
abstractions don't have it. I could start to picture about this if this
is necessary.

Z.