mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add SupportedIoctls() to nvproxy.
This allows callers to get all the ioctl/command/class numbers that nvproxy supports. PiperOrigin-RevId: 599298654
This commit is contained in:
@@ -377,3 +377,30 @@ func ExpectedDriverChecksum(version DriverVersion) (string, bool) {
|
||||
}
|
||||
return abi.checksum, true
|
||||
}
|
||||
|
||||
// SupportedIoctls returns the ioctl numbers that are supported by nvproxy at
|
||||
// a given version.
|
||||
func SupportedIoctls(version DriverVersion) (frontendIoctls map[uint32]struct{}, uvmIoctls map[uint32]struct{}, controlCmds map[uint32]struct{}, allocClasses map[uint32]struct{}, ok bool) {
|
||||
abiCons, ok := abis[version]
|
||||
if !ok {
|
||||
return nil, nil, nil, nil, false
|
||||
}
|
||||
abi := abiCons.cons()
|
||||
frontendIoctls = make(map[uint32]struct{})
|
||||
for ioc := range abi.frontendIoctl {
|
||||
frontendIoctls[ioc] = struct{}{}
|
||||
}
|
||||
uvmIoctls = make(map[uint32]struct{})
|
||||
for ioc := range abi.uvmIoctl {
|
||||
uvmIoctls[ioc] = struct{}{}
|
||||
}
|
||||
controlCmds = make(map[uint32]struct{})
|
||||
for cmd := range abi.controlCmd {
|
||||
controlCmds[cmd] = struct{}{}
|
||||
}
|
||||
allocClasses = make(map[uint32]struct{})
|
||||
for class := range abi.allocationClass {
|
||||
allocClasses[class] = struct{}{}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user