Add NvidiaDeviceFD interface to nvproxy package.

This can be helpful for identifying Nvidia device FDs.

PiperOrigin-RevId: 640743124
This commit is contained in:
Ayush Ranjan
2024-06-05 20:17:23 -07:00
committed by gVisor bot
parent a9c39ed0a7
commit 6b537e43eb
3 changed files with 12 additions and 0 deletions
+3
View File
@@ -202,6 +202,9 @@ func (fd *frontendFD) Ioctl(ctx context.Context, uio usermem.IO, sysno uintptr,
return handler(&fi)
}
// IsNvidiaDeviceFD implements NvidiaDeviceFD.IsNvidiaDeviceFD.
func (fd *frontendFD) IsNvidiaDeviceFD() {}
func frontendIoctlCmd(nr, argSize uint32) uintptr {
return uintptr(linux.IOWR(nvgpu.NV_IOCTL_MAGIC, nr, argSize))
}
+6
View File
@@ -100,3 +100,9 @@ type hasFrontendFDPtr[T any] interface {
marshalPtr[T]
nvgpu.HasFrontendFD
}
// NvidiaDeviceFD is an interface that should be implemented by all
// vfs.FileDescriptionImpl of Nvidia devices.
type NvidiaDeviceFD interface {
IsNvidiaDeviceFD()
}
+3
View File
@@ -151,6 +151,9 @@ func (fd *uvmFD) Ioctl(ctx context.Context, uio usermem.IO, sysno uintptr, args
return handler(&ui)
}
// IsNvidiaDeviceFD implements NvidiaDeviceFD.IsNvidiaDeviceFD.
func (fd *uvmFD) IsNvidiaDeviceFD() {}
// uvmIoctlState holds the state of a call to uvmFD.Ioctl().
type uvmIoctlState struct {
fd *uvmFD