MCPcopy
hub / github.com/google/gvisor / pciDeviceFD

Struct pciDeviceFD

pkg/sentry/devices/tpuproxy/vfio/pci_device_fd.go:42–62  ·  view source on GitHub ↗

pciDeviceFD implements vfs.FileDescriptionImpl for TPU's PCI device. +stateify savable

Source from the content-addressed store, hash-verified

40//
41// +stateify savable
42type 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
64func (fd *pciDeviceFD) isRestored() bool {
65 return fd.hostFD == -1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected