github.com/openshift/dpu-operator@v0.0.0-20240502153209-3af840d137c2/dpu-cni/pkgs/sriovtypes/sriovtypes.go (about)

     1  package sriovtypes
     2  
     3  import (
     4  	"regexp"
     5  )
     6  
     7  var (
     8  	rePciDeviceName = regexp.MustCompile(`^[0-9a-f]{4}:[0-9a-f]{2}:[01][0-9a-f]\.[0-7]$`)
     9  	reAuxDeviceName = regexp.MustCompile(`^\w+.\w+.\d+$`)
    10  )
    11  
    12  // IsPCIDeviceName check if passed device id is a PCI device name
    13  func IsPCIDeviceName(deviceID string) bool {
    14  	return rePciDeviceName.MatchString(deviceID)
    15  }
    16  
    17  // IsAuxDeviceName check if passed device id is a Auxiliary device name
    18  func IsAuxDeviceName(deviceID string) bool {
    19  	return reAuxDeviceName.MatchString(deviceID)
    20  }