Skip to content

Commit

Permalink
unix: add IoctlLoopConfigure on linux
Browse files Browse the repository at this point in the history
LOOP_CONFIGURE ioctl is used to setup and configure all loop device
parameters in a single step.
  • Loading branch information
alex-matei committed Nov 6, 2023
1 parent 1bfbee0 commit f9cc4c9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions unix/ioctl_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
1 change: 1 addition & 0 deletions unix/linux/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3001,6 +3001,7 @@ const (

type LoopInfo C.struct_loop_info
type LoopInfo64 C.struct_loop_info64
type LoopConfig C.struct_loop_config

// AF_TIPC

Expand Down
1 change: 1 addition & 0 deletions unix/mkerrors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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$/ ||
Expand Down
1 change: 1 addition & 0 deletions unix/zerrors_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions unix/ztypes_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f9cc4c9

Please sign in to comment.