-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
todoNeeds to be done at some pointNeeds to be done at some point
Description
Based on feedback from Gnif the iommu probing logic might be able to be cleaned up a bit to avoid deep nesting
something like
func GetDevicesFromGroups(groups []int, related int, pArg *params.Params) []string {
var output []string:
if len(groups) == 0)
return output
alldevs := NewIOMMU()
for _, group := range groups {
if _, iommu_num := alldevs.Groups[group]; !iommu_num {
errorcheck.ErrorCheck(fmt.Errorf("IOMMU Group %v does not exist", group))
continue
}
.. do stuff ...
}
return output
}
and also cleanup with
for ... {
if (a) {
// do stuff
continue;
}
if (b) {
// do stuff
continue;
}
}
Writing this here as notes for myself incase i do not get to this before my vacation and the messages get drowned in discord.
The original code was written as it is now, it was easier to follow logic wise for my brain and was slated for a rewrite (which i forgot due to priorities elsewhere).
Metadata
Metadata
Assignees
Labels
todoNeeds to be done at some pointNeeds to be done at some point