Skip to content

Commit c2dfae8

Browse files
committed
go.mod: Bump golang.org/x/sys to v0.17.0
Replace internal LOOP_CONFIGURE ioctl implementation with IoctlLoopConfigure from sys Signed-off-by: Alexandru Matei <[email protected]>
1 parent 2c7520d commit c2dfae8

39 files changed

+222
-90
lines changed

core/mount/losetup_linux.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import (
2121
"fmt"
2222
"os"
2323
"strings"
24-
"syscall"
2524
"time"
26-
"unsafe"
2725

2826
"github.com/containerd/containerd/v2/internal/randutil"
2927
kernel "github.com/containerd/containerd/v2/pkg/kernelversion"
@@ -35,8 +33,6 @@ const (
3533
loopDevFormat = "/dev/loop%d"
3634

3735
ebusyString = "device or resource busy"
38-
39-
loopConfigureIoctl = 0x4c0a
4036
)
4137

4238
type LoopConfig struct {
@@ -46,15 +42,6 @@ type LoopConfig struct {
4642
Reserved [8]uint64
4743
}
4844

49-
func ioctlConfigure(fd int, value *LoopConfig) error {
50-
_, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), uintptr(loopConfigureIoctl), uintptr(unsafe.Pointer(value)))
51-
if err == 0 {
52-
return nil
53-
}
54-
55-
return err
56-
}
57-
5845
// LoopParams parameters to control loop device setup
5946
type LoopParams struct {
6047
// Loop device should forbid write
@@ -107,7 +94,7 @@ func setupLoopDev(backingFile, loopDev string, param LoopParams) (_ *os.File, re
10794

10895
fiveDotEight := kernel.KernelVersion{Kernel: 5, Major: 8}
10996
if ok, err := kernel.GreaterEqualThan(fiveDotEight); err == nil && ok {
110-
config := LoopConfig{
97+
config := unix.LoopConfig{
11198
Fd: uint32(back.Fd()),
11299
}
113100

@@ -124,7 +111,7 @@ func setupLoopDev(backingFile, loopDev string, param LoopParams) (_ *os.File, re
124111
config.Info.Flags |= unix.LO_FLAGS_DIRECT_IO
125112
}
126113

127-
if err := ioctlConfigure(int(loop.Fd()), &config); err != nil {
114+
if err := unix.IoctlLoopConfigure(int(loop.Fd()), &config); err != nil {
128115
return nil, fmt.Errorf("failed to configure loop device: %s: %w", loopDev, err)
129116
}
130117

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ require (
6767
go.opentelemetry.io/otel/trace v1.23.1
6868
golang.org/x/mod v0.14.0
6969
golang.org/x/sync v0.6.0
70-
golang.org/x/sys v0.16.0
70+
golang.org/x/sys v0.17.0
7171
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917
7272
google.golang.org/grpc v1.61.0
7373
google.golang.org/protobuf v1.32.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
451451
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
452452
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
453453
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
454-
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
455-
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
454+
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
455+
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
456456
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
457457
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
458458
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=

vendor/golang.org/x/sys/unix/mkerrors.sh

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/zerrors_linux.go

Lines changed: 35 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/zerrors_linux_386.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/zerrors_linux_arm.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)