improve device and function (subdevice) types

This commit is contained in:
2025-02-10 22:08:02 +00:00
parent 31fb710410
commit a2f467d1a6
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)
}
*/