pciDeviceFD implements vfs.FileDescriptionImpl for TPU's PCI device. +stateify savable
| 40 | // |
| 41 | // +stateify savable |
| 42 | type pciDeviceFD struct { |
| 43 | vfsfd vfs.FileDescription |
| 44 | vfs.FileDescriptionDefaultImpl |
| 45 | vfs.DentryMetadataFileDescriptionImpl |
| 46 | vfs.NoLockFD |
| 47 | |
| 48 | // If hostFD is -1, this file descriptor has been restored from a save state, |
| 49 | // and should be treated as invalid. Any operations on this file descriptor |
| 50 | // will effectively be a no-op. |
| 51 | hostFD int32 |
| 52 | queue waiter.Queue |
| 53 | |
| 54 | // TODO: pciDeviceFD.InvalidateUnsavable uses this state, but AFAIU |
| 55 | // pciDeviceFD.Translate will return the same File and offset after |
| 56 | // save/restore, so this is unnecessary, and we can use |
| 57 | // memmap.MappableNoTrackMappings instead. |
| 58 | mapsMu sync.Mutex `state:"nosave"` |
| 59 | // +checklocks:mapsMu |
| 60 | mappings memmap.MappingSet |
| 61 | memmapFile fsutil.MmapPreciseFile |
| 62 | } |
| 63 | |
| 64 | func (fd *pciDeviceFD) isRestored() bool { |
| 65 | return fd.hostFD == -1 |
nothing calls this directly
no outgoing calls
no test coverage detected