fn attach_virtio_device<T: 'static + VirtioDevice + MutEventSubscriber>(
    event_manager: &mut EventManager,
    vmm: &mut Vmm,
    id: String,
    device: Arc<Mutex<T>>,
    cmdline: &mut LoaderKernelCmdline,
) -> std::result::Result<(), StartMicrovmError> {
    use self::StartMicrovmError::*;

    event_manager.add_subscriber(device.clone());

    // The device mutex mustn't be locked here otherwise it will deadlock.
    let device = MmioTransport::new(vmm.guest_memory().clone(), device);
    vmm.mmio_device_manager
        .register_mmio_virtio_for_boot(vmm.vm.fd(), id, device, cmdline)
        .map_err(RegisterMmioDevice)
        .map(|_| ())
}
/// Attaches a VirtioDevice device to the device manager and event manager.
Attaches a VirtioDevice device to the device manager and event manager.
Attaches a VirtioDevice device to the device manager and event manager .
fn attach_virtio_device<T: 'static + VirtioDevice + MutEventSubscriber>(
    event_manager: &mut EventManager,
    vmm: &mut Vmm,
    id: String,
    device: Arc<Mutex<T>>,
    cmdline: &mut LoaderKernelCmdline,
) -> std::result::Result<(), StartMicrovmError> {
    use self::StartMicrovmError::*;
    event_manager.add_subscriber(device.clone());
    // The device mutex mustn't be locked here otherwise it will deadlock.
    let device = MmioTransport::new(vmm.guest_memory().clone(), device);
    vmm.mmio_device_manager
        .register_mmio_virtio_for_boot(vmm.vm.fd(), id, device, cmdline)
        .map_err(RegisterMmioDevice)
        .map(|_| ())
}
fn attach_virtio_device < T : ' static + VirtioDevice + MutEventSubscriber > ( event_manager : & mut EventManager , vmm : & mut Vmm , id : String , device : Arc < Mutex < T > > , cmdline : & mut LoaderKernelCmdline , ) -> std :: result :: Result < ( ) , StartMicrovmError > { use self :: StartMicrovmError :: * ; event_manager . add_subscriber ( device . clone ( ) ) ; // The device mutex mustn't be locked here otherwise it will deadlock. let device = MmioTransport :: new ( vmm . guest_memory ( ) . clone ( ) , device ) ; vmm . mmio_device_manager . register_mmio_virtio_for_boot ( vmm . vm . fd ( ) , id , device , cmdline ) . map_err ( RegisterMmioDevice ) . map ( | _ | ( ) ) }
Attaches a VirtioDevice device to the device manager and event manager.
Attaches a VirtioDevice device to the device manager and event manager .
event_manager
&mut EventManager
vmm
&mut Vmm
id
String
device
Arc<Mutex<T>>
cmdline
&mut LoaderKernelCmdline
event_manager
&mut EventManager
vmm
&mut Vmm
id
String
device
Arc<Mutex<T>>
cmdline
&mut LoaderKernelCmdline