mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 08:37:31 -04:00
unix: add EthtoolDrvinfo and IoctlGetEthtoolDrvinfo on linux
Add type EthtoolDrvinfo and the type-safe IoctlGetEthtoolDrvinfo ioctl wrapper func to retrieve it. Change-Id: Ia514df89175939d9b0c2c4ddace621882e86b21a Reviewed-on: https://go-review.googlesource.com/c/sys/+/308989 Trust: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Matt Layher <mdlayher@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
46babdb380
commit
f1c623a9e7
@@ -95,6 +95,15 @@ func main() {
|
||||
b = bytes.Replace(b, s, newNames, 1)
|
||||
}
|
||||
|
||||
// Convert []int8 to []byte in EthtoolDrvinfo
|
||||
convertEthtoolDrvinfoNames := regexp.MustCompile(`(Driver|Version|Fw_version|Bus_info|Erom_version|Reserved2)(\s+)\[(\d+)\]u?int8`)
|
||||
ethtoolDrvinfoTypes := regexp.MustCompile(`type EthtoolDrvinfo struct {[^}]*}`)
|
||||
ethtoolDrvinfoStructs := ethtoolDrvinfoTypes.FindAll(b, -1)
|
||||
for _, s := range ethtoolDrvinfoStructs {
|
||||
newNames := convertEthtoolDrvinfoNames.ReplaceAll(s, []byte("$1$2[$3]byte"))
|
||||
b = bytes.Replace(b, s, newNames, 1)
|
||||
}
|
||||
|
||||
// Convert []int8 to []byte in ctl_info ioctl interface
|
||||
convertCtlInfoName := regexp.MustCompile(`(Name)(\s+)\[(\d+)\]int8`)
|
||||
ctlInfoType := regexp.MustCompile(`type CtlInfo struct {[^}]*}`)
|
||||
|
||||
Reference in New Issue
Block a user