mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add NvidiaDeviceFD interface to nvproxy package.
This can be helpful for identifying Nvidia device FDs. PiperOrigin-RevId: 640743124
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user