improve device and function (subdevice) types

This commit is contained in:
2025-02-11 07:11:05 +00:00
parent bf5196763d
commit e99a9c8c79
4 changed files with 100 additions and 53 deletions

View File

@@ -41,8 +41,8 @@ func GetConfig(configPath string) Config {
// subsystem devices always has the format xxxx:yy.z, whereas super devices have the format xxxx:yy
//
// returns true if BusID has format xxxx:yy
func DeviceBusIDIsSuperDevice(BusID string) bool {
return !strings.ContainsRune(BusID, '.')
func DeviceBusIDIsSuperDevice(BusID DeviceID) bool {
return !strings.ContainsRune(string(BusID), '.')
}
// returns if a device pcie bus id is a subdevice of specified super device
@@ -50,6 +50,8 @@ func DeviceBusIDIsSuperDevice(BusID string) bool {
// subsystem devices always has the format xxxx:yy.z, whereas super devices have the format xxxx:yy
//
// returns true if BusID has prefix SuperDeviceBusID and SuperDeviceBusID is a Super Device
/*
func DeviceBusIDIsSubDevice(BusID string, SuperDeviceBusID string) bool {
return DeviceBusIDIsSuperDevice(SuperDeviceBusID) && strings.HasPrefix(BusID, SuperDeviceBusID)
}
*/