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 de08633
Show file tree
Hide file tree
Showing 5 changed files with 16 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))
}
2 changes: 2 additions & 0 deletions unix/linux/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5829,3 +5829,5 @@ const SizeofSchedAttr = C.sizeof_struct_sched_attr

type Cachestat_t C.struct_cachestat
type CachestatRange C.struct_cachestat_range

type LoopConfig C.struct_loop_config
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.

7 changes: 7 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 de08633

Please sign in to comment.