unix: add PTP IOCTLs on Linux

The IOCTLs are used for interacting with PTP-specific functions of NIC and time card drivers.

Description:
https://netdevconf.info/0x18/docs/netdev-0x18-paper39-talk-slides/netdev-intro-ptp-api.pdf

Change-Id: If50d605958e5cee451146cf68cc95a3704917512
GitHub-Last-Rev: 44fac1cb1a96b28050f9b9b0c2d986b0feba933f
GitHub-Pull-Request: golang/sys#225
Reviewed-on: https://go-review.googlesource.com/c/sys/+/621375
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Yaroslav Kolomiiets
2024-10-21 18:42:12 +00:00
committed by Gopher Robot
parent adbb8bbcaf
commit 256d1dfe8f
21 changed files with 381 additions and 0 deletions
+9
View File
@@ -185,6 +185,15 @@ func main() {
b = bytes.Replace(b, s, newNames, 1)
}
// Convert []int8 to []byte in PtpPinDesc
ptpBytesRegex := regexp.MustCompile(`(Name)(\s+)\[(\d+)\]u?int8`)
ptpIoctlType := regexp.MustCompile(`PtpPinDesc\s+struct {[^}]*}`)
ptpStructs := ptpIoctlType.FindAll(b, -1)
for _, s := range ptpStructs {
newNames := ptpBytesRegex.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 {[^}]*}`)