pub trait Operations:
Sized
+ Send
+ Sync
+ 'static {
type RegistrationData<'a>: Send + Sync + 'a
where Self: 'a;
const DEVICE_TYPE: DeviceType;
// Required methods
fn open<'a>(
device: &Device<Self>,
reg_data: &Self::RegistrationData<'a>,
) -> impl PinInit<Self, Error>;
fn fw_rpc<'a>(
this: Pin<&Self>,
device: &Device<Self>,
reg_data: &Self::RegistrationData<'a>,
scope: RpcScope,
rpc_buf: &mut [u8],
max_output_len: usize,
) -> Result<FwRpcResponse, Error>;
// Provided methods
fn close<'a>(
_this: Pin<&mut Self>,
_device: &Device<Self>,
_reg_data: &Self::RegistrationData<'a>,
) { ... }
fn info<'a>(
_this: Pin<&Self>,
_device: &Device<Self>,
_reg_data: &Self::RegistrationData<'a>,
) -> Result<KVec<u8>, Error> { ... }
}Expand description
Trait implemented by each Rust driver that integrates with the fwctl subsystem.
The implementing type is the per-FD user context: one instance is
created for each open() call and dropped when the FD is closed.
Each implementation corresponds to a specific device type and provides the
vtable used by the core fwctl layer to manage per-FD user contexts and
handle RPC requests.
Required Associated Constants§
Sourceconst DEVICE_TYPE: DeviceType
const DEVICE_TYPE: DeviceType
fwctl device type identifier.
Required Associated Types§
Sourcetype RegistrationData<'a>: Send + Sync + 'a
where
Self: 'a
type RegistrationData<'a>: Send + Sync + 'a where Self: 'a
Data owned by the Registration and accessible during callbacks.
The lifetime 'a is tied to the Registration scope (which lives within the parent bus
device binding scope). Drivers use it to store references to resources bound to this scope,
such as PCI BARs or typed bus device references.
Required Methods§
Sourcefn open<'a>(
device: &Device<Self>,
reg_data: &Self::RegistrationData<'a>,
) -> impl PinInit<Self, Error>
fn open<'a>( device: &Device<Self>, reg_data: &Self::RegistrationData<'a>, ) -> impl PinInit<Self, Error>
Sourcefn fw_rpc<'a>(
this: Pin<&Self>,
device: &Device<Self>,
reg_data: &Self::RegistrationData<'a>,
scope: RpcScope,
rpc_buf: &mut [u8],
max_output_len: usize,
) -> Result<FwRpcResponse, Error>
fn fw_rpc<'a>( this: Pin<&Self>, device: &Device<Self>, reg_data: &Self::RegistrationData<'a>, scope: RpcScope, rpc_buf: &mut [u8], max_output_len: usize, ) -> Result<FwRpcResponse, Error>
Handle a userspace RPC request.
max_output_len is the size of the userspace output buffer. A driver may return a larger
response to report the required size; the fwctl core copies only the bytes that fit and
reports the full response length to userspace.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".