MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / drop

Method drop

crates/openshell-vfio/src/pci.rs:158–174  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

156
157impl Drop for PciBindGuard {
158 fn drop(&mut self) {
159 if self.disarmed {
160 return;
161 }
162 if self.vfio_id.is_some() {
163 self.restore_with_cached_id();
164 } else {
165 for peer in &self.companion_bdfs {
166 if let Err(err) = crate::bind::restore_to_host_driver(&self.sysfs, peer) {
167 tracing::error!(bdf = %peer, error = %err, "failed to restore companion device to host driver on drop");
168 }
169 }
170 if let Err(err) = crate::bind::restore_to_host_driver(&self.sysfs, &self.bdf) {
171 tracing::error!(bdf = %self.bdf, error = %err, "failed to restore PCI device to host driver on drop");
172 }
173 }
174 }
175}
176
177/// Persisted record of PCI devices currently bound to vfio-pci, for crash recovery.

Callers

nothing calls this directly

Calls 2

restore_to_host_driverFunction · 0.85

Tested by

no test coverage detected