unix: add IoctlLoopConfigure on linux LOOP_CONFIGURE ioctl is used to setup and configure all loop device parameters in a single step. Add to the unix package a new function that exposes LOOP_CONFIGURE. Fixes golang/go#63962 Change-Id: Ia169d268b52b1384febc6bff9c707b721ab2bb24 GitHub-Last-Rev: f9cc4c94cb654afd596df6e28a0d0a1bf60d15eb GitHub-Pull-Request: golang/sys#181 Reviewed-on: https://go-review.googlesource.com/c/sys/+/540075 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/unix/ioctl_linux.go b/unix/ioctl_linux.go index 0d12c08..dbe680e 100644 --- a/unix/ioctl_linux.go +++ b/unix/ioctl_linux.go
@@ -231,3 +231,8 @@ func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error { return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value)) } + +// IoctlLoopConfigure configures all loop device parameters in a single step +func IoctlLoopConfigure(fd int, value *LoopConfig) error { + return ioctlPtr(fd, LOOP_CONFIGURE, unsafe.Pointer(value)) +}
diff --git a/unix/linux/types.go b/unix/linux/types.go index 47c06ee..9297fcf 100644 --- a/unix/linux/types.go +++ b/unix/linux/types.go
@@ -3027,6 +3027,7 @@ type LoopInfo C.struct_loop_info type LoopInfo64 C.struct_loop_info64 +type LoopConfig C.struct_loop_config // AF_TIPC
diff --git a/unix/mkerrors.sh b/unix/mkerrors.sh index 5dda445..6202638 100755 --- a/unix/mkerrors.sh +++ b/unix/mkerrors.sh
@@ -519,6 +519,7 @@ $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^LO_(KEY|NAME)_SIZE$/ || $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || + $2 == "LOOP_CONFIGURE" || $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ || $2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ || $2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
diff --git a/unix/zerrors_linux.go b/unix/zerrors_linux.go index 1781cfc..c73cfe2 100644 --- a/unix/zerrors_linux.go +++ b/unix/zerrors_linux.go
@@ -1801,6 +1801,7 @@ LOCK_SH = 0x1 LOCK_UN = 0x8 LOOP_CLR_FD = 0x4c01 + LOOP_CONFIGURE = 0x4c0a LOOP_CTL_ADD = 0x4c80 LOOP_CTL_GET_FREE = 0x4c82 LOOP_CTL_REMOVE = 0x4c81
diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go index b07276a..bbf8399 100644 --- a/unix/ztypes_linux.go +++ b/unix/ztypes_linux.go
@@ -3005,6 +3005,12 @@ Encrypt_key [32]uint8 Init [2]uint64 } +type LoopConfig struct { + Fd uint32 + Size uint32 + Info LoopInfo64 + _ [8]uint64 +} type TIPCSocketAddr struct { Ref uint32