diff --git a/unix/ioctl_linux.go b/unix/ioctl_linux.go index 0d12c0851..dbe680eab 100644 --- a/unix/ioctl_linux.go +++ b/unix/ioctl_linux.go @@ -231,3 +231,8 @@ func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) { 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 47c06ee76..9297fcfaa 100644 --- a/unix/linux/types.go +++ b/unix/linux/types.go @@ -3027,6 +3027,7 @@ const ( 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 5dda44503..6202638ba 100755 --- a/unix/mkerrors.sh +++ b/unix/mkerrors.sh @@ -519,6 +519,7 @@ ccflags="$@" $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 1781cfca3..c73cfe2f1 100644 --- a/unix/zerrors_linux.go +++ b/unix/zerrors_linux.go @@ -1801,6 +1801,7 @@ const ( 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 b07276a1b..bbf8399ff 100644 --- a/unix/ztypes_linux.go +++ b/unix/ztypes_linux.go @@ -3005,6 +3005,12 @@ type LoopInfo64 struct { Encrypt_key [32]uint8 Init [2]uint64 } +type LoopConfig struct { + Fd uint32 + Size uint32 + Info LoopInfo64 + _ [8]uint64 +} type TIPCSocketAddr struct { Ref uint32