Skip to content

Commit 13b15b7

Browse files
alex-mateigopherbot
authored andcommitted
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: f9cc4c9 GitHub-Pull-Request: #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>
1 parent 11eadc0 commit 13b15b7

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

unix/ioctl_linux.go

+5
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,8 @@ func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) {
231231
func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error {
232232
return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value))
233233
}
234+
235+
// IoctlLoopConfigure configures all loop device parameters in a single step
236+
func IoctlLoopConfigure(fd int, value *LoopConfig) error {
237+
return ioctlPtr(fd, LOOP_CONFIGURE, unsafe.Pointer(value))
238+
}

unix/linux/types.go

+1
Original file line numberDiff line numberDiff line change
@@ -3027,6 +3027,7 @@ const (
30273027

30283028
type LoopInfo C.struct_loop_info
30293029
type LoopInfo64 C.struct_loop_info64
3030+
type LoopConfig C.struct_loop_config
30303031

30313032
// AF_TIPC
30323033

unix/mkerrors.sh

+1
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ ccflags="$@"
519519
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
520520
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
521521
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
522+
$2 == "LOOP_CONFIGURE" ||
522523
$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)_/ ||
523524
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
524525
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||

unix/zerrors_linux.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/ztypes_linux.go

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)