pub trait DeviceOps:
DynClone
+ Send
+ Sync
+ AsAny
+ 'static {
// Required method
fn open(
&self,
locked: &mut Locked<FileOpsCore>,
current_task: &CurrentTask,
device_type: DeviceType,
node: &NamespaceNode,
flags: OpenFlags,
) -> Result<Box<dyn FileOps>, Errno>;
}Required Methods§
Sourcefn open(
&self,
locked: &mut Locked<FileOpsCore>,
current_task: &CurrentTask,
device_type: DeviceType,
node: &NamespaceNode,
flags: OpenFlags,
) -> Result<Box<dyn FileOps>, Errno>
fn open( &self, locked: &mut Locked<FileOpsCore>, current_task: &CurrentTask, device_type: DeviceType, node: &NamespaceNode, flags: OpenFlags, ) -> Result<Box<dyn FileOps>, Errno>
Instantiate a FileOps for this device.
This function is called when userspace opens a file with a DeviceType
assigned to this device.
Implementations on Foreign Types§
Source§impl DeviceOps for Arc<SerialDevice>
impl DeviceOps for Arc<SerialDevice>
fn open( &self, _locked: &mut Locked<FileOpsCore>, _current_task: &CurrentTask, _id: DeviceType, _node: &NamespaceNode, _flags: OpenFlags, ) -> Result<Box<dyn FileOps>, Errno>
Implementors§
impl<F> DeviceOps for Fwhere
F: Clone + Send + Sync + Fn(&mut Locked<FileOpsCore>, &CurrentTask, DeviceType, &NamespaceNode, OpenFlags) -> Result<Box<dyn FileOps>, Errno> + 'static,
Allows directly using a function or closure as an implementation of DeviceOps, avoiding having to write a zero-size struct and an impl for it.