Adopt ownership of a `PCIe` device that is already bound to `vfio-pci`. This is the restart-reconciliation counterpart to [`prepare_pci_for_passthrough`]. It validates that the device exists, that all IOMMU peers are already on `vfio-pci`, and that the primary BDF is currently bound to `vfio-pci`, then returns a guard that will restore the device on drop. It does not write `driver_override`, `new
(sysfs: &SysfsRoot, bdf: &str)
| 61 | /// the device on drop. It does not write `driver_override`, `new_id`, or |
| 62 | /// `drivers_probe`. |
| 63 | pub fn adopt(sysfs: &SysfsRoot, bdf: &str) -> Result<Self, VfioError> { |
| 64 | validate_pci_for_passthrough(sysfs, bdf)?; |
| 65 | ensure_bound_to_vfio(sysfs, bdf)?; |
| 66 | |
| 67 | let vfio_id = crate::bind::vfio_id_string(sysfs, bdf); |
| 68 | |
| 69 | Ok(Self::new_armed( |
| 70 | bdf.to_string(), |
| 71 | Vec::new(), |
| 72 | sysfs.clone(), |
| 73 | vfio_id, |
| 74 | )) |
| 75 | } |
| 76 | |
| 77 | /// Adopt ownership of a complete IOMMU group already bound to `vfio-pci`. |
| 78 | /// |
nothing calls this directly
no test coverage detected