From 973fd4e92c095e65e0d2d0b35d66c66831426fe0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 28 Sep 2024 03:59:59 +0000 Subject: [PATCH] fix(deps): update patch digest dependencies --- go.mod | 4 +- go.sum | 8 ++-- .../longhorn/go-common-libs/io/file.go | 13 ++++--- .../longhorn/go-common-libs/ns/joiner.go | 27 +------------ .../go-common-libs/ns/joiner_darwin.go | 10 +++++ .../go-common-libs/ns/joiner_linux.go | 38 +++++++++++++++++++ .../longhorn/go-common-libs/sys/sys.go | 6 +-- .../go-common-libs/types/namespace.go | 11 ------ .../go-common-libs/types/namespace_darwin.go | 5 +++ .../go-common-libs/types/namespace_linux.go | 14 +++++++ vendor/modules.txt | 4 +- 11 files changed, 86 insertions(+), 54 deletions(-) create mode 100644 vendor/github.com/longhorn/go-common-libs/ns/joiner_darwin.go create mode 100644 vendor/github.com/longhorn/go-common-libs/ns/joiner_linux.go create mode 100644 vendor/github.com/longhorn/go-common-libs/types/namespace_darwin.go create mode 100644 vendor/github.com/longhorn/go-common-libs/types/namespace_linux.go diff --git a/go.mod b/go.mod index 09a1a56fb..e93e17470 100644 --- a/go.mod +++ b/go.mod @@ -11,10 +11,10 @@ require ( github.com/gorilla/handlers v1.5.2 github.com/gorilla/mux v1.8.1 github.com/longhorn/backupstore v0.0.0-20240922062439-e33cb1230db9 - github.com/longhorn/go-common-libs v0.0.0-20240921050101-797b589b669d + github.com/longhorn/go-common-libs v0.0.0-20240926084818-3a320d860af4 github.com/longhorn/go-iscsi-helper v0.0.0-20240922062410-c17a624e50c1 github.com/longhorn/sparse-tools v0.0.0-20240907135423-37af3c64d59d - github.com/longhorn/types v0.0.0-20240902072916-1bf23d310acb + github.com/longhorn/types v0.0.0-20240925015253-4dae7c529d85 github.com/moby/moby v23.0.14+incompatible github.com/pkg/errors v0.9.1 github.com/rancher/go-fibmap v0.0.0-20160418233256-5fc9f8c1ed47 diff --git a/go.sum b/go.sum index d2e2ae89f..763f7e133 100644 --- a/go.sum +++ b/go.sum @@ -80,14 +80,14 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/longhorn/backupstore v0.0.0-20240922062439-e33cb1230db9 h1:ua4PCfArX2TyPVnldF+m7I9c2eGi+TcP8pcPPx2wp0w= github.com/longhorn/backupstore v0.0.0-20240922062439-e33cb1230db9/go.mod h1:UTONYTgRryrw0RgDZbxwU+r1s4PeKQ+v0Z8Pb6jUWn4= -github.com/longhorn/go-common-libs v0.0.0-20240921050101-797b589b669d h1:MXJlzyXLptspJEc1UC7ee2eBIYksTl0RT2bXUAXU+8Q= -github.com/longhorn/go-common-libs v0.0.0-20240921050101-797b589b669d/go.mod h1:L8QlyY7cqL84FcxnJ8HK6DaQ1Ej9JiZtZ94OW5W+Yyw= +github.com/longhorn/go-common-libs v0.0.0-20240926084818-3a320d860af4 h1:XIVowDtBbw8kAEf0JCCFx5eMyUkuDBhAhpM3WtUAN0U= +github.com/longhorn/go-common-libs v0.0.0-20240926084818-3a320d860af4/go.mod h1:L8QlyY7cqL84FcxnJ8HK6DaQ1Ej9JiZtZ94OW5W+Yyw= github.com/longhorn/go-iscsi-helper v0.0.0-20240922062410-c17a624e50c1 h1:YyIB/R5Yosb+3Rgc7FRugKVqJnxyN/+P4CrQ7tMSXqc= github.com/longhorn/go-iscsi-helper v0.0.0-20240922062410-c17a624e50c1/go.mod h1:X/Cege7q+oovt0SrEyky6ClDHj8IIQE3O0iI+dzgLno= github.com/longhorn/sparse-tools v0.0.0-20240907135423-37af3c64d59d h1:iNrrGcE9TLcaayQgOkdEZDvlzKCWMNhXXJD2d2K4Wyo= github.com/longhorn/sparse-tools v0.0.0-20240907135423-37af3c64d59d/go.mod h1:iUJCZtOKG/9xv2rfrUAYZntFTzP5dZtvy4Kwe6dMcUc= -github.com/longhorn/types v0.0.0-20240902072916-1bf23d310acb h1:8CoW5YYn+SC43o5zFR+wscOd3SgF6rQZjrkXOkJfZPM= -github.com/longhorn/types v0.0.0-20240902072916-1bf23d310acb/go.mod h1:KlJuZB8NfHchWshYxYgV9pPIxBKC04Vq05G2TfgMf7w= +github.com/longhorn/types v0.0.0-20240925015253-4dae7c529d85 h1:8WJ4HBvbTtF7ge/BBupC/gK/BjOghdY7AHEp7xAq+KQ= +github.com/longhorn/types v0.0.0-20240925015253-4dae7c529d85/go.mod h1:KlJuZB8NfHchWshYxYgV9pPIxBKC04Vq05G2TfgMf7w= github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= diff --git a/vendor/github.com/longhorn/go-common-libs/io/file.go b/vendor/github.com/longhorn/go-common-libs/io/file.go index d4ad1c006..aea7fd4bb 100644 --- a/vendor/github.com/longhorn/go-common-libs/io/file.go +++ b/vendor/github.com/longhorn/go-common-libs/io/file.go @@ -12,6 +12,7 @@ import ( "github.com/pkg/errors" "github.com/shirou/gopsutil/v3/disk" "github.com/sirupsen/logrus" + "golang.org/x/sys/unix" "github.com/longhorn/go-common-libs/types" ) @@ -227,8 +228,8 @@ func GetDiskStat(path string) (diskStat types.DiskStat, err error) { err = errors.Wrapf(err, "failed to get fs stat for %v", path) }() - var statfs syscall.Statfs_t - if err := syscall.Statfs(path, &statfs); err != nil { + var statfs unix.Statfs_t + if err := unix.Statfs(path, &statfs); err != nil { return diskStat, err } @@ -239,7 +240,7 @@ func GetDiskStat(path string) (diskStat types.DiskStat, err error) { // Convert the FSID components to a single uint64 FSID value var fsidValue uint64 - for _, component := range statfs.Fsid.X__val { + for _, component := range statfs.Fsid.Val { // Combine components using bit manipulation fsidValue = (fsidValue << 32) | uint64(uint32(component)) } @@ -254,9 +255,9 @@ func GetDiskStat(path string) (diskStat types.DiskStat, err error) { Driver: types.DiskDriverNone, FreeBlocks: int64(statfs.Bfree), TotalBlocks: int64(statfs.Blocks), - BlockSize: statfs.Bsize, - StorageMaximum: int64(statfs.Blocks) * statfs.Bsize, - StorageAvailable: int64(statfs.Bfree) * statfs.Bsize, + BlockSize: int64(statfs.Bsize), + StorageMaximum: int64(statfs.Blocks) * int64(statfs.Bsize), + StorageAvailable: int64(statfs.Bfree) * int64(statfs.Bsize), }, nil } diff --git a/vendor/github.com/longhorn/go-common-libs/ns/joiner.go b/vendor/github.com/longhorn/go-common-libs/ns/joiner.go index b62e9c9bc..09c7ace13 100644 --- a/vendor/github.com/longhorn/go-common-libs/ns/joiner.go +++ b/vendor/github.com/longhorn/go-common-libs/ns/joiner.go @@ -46,31 +46,6 @@ func (joiners *Joiners) JoinReverse() (err error) { return joiners.Join() } -// Join joins all the namespaces in the Joiners. -func (joiners *Joiners) Join() (err error) { - for _, joiner := range *joiners { - if joiner.isJoined { - logrus.Tracef("Already joined namespace: %s", joiner.namespace) - continue - } - - if joiner.namespace == types.NamespaceMnt { - err := unix.Unshare(unix.CLONE_NEWNS) - if err != nil { - return errors.Wrapf(err, "failed to unshare namespace: %+s", joiner.namespace) - } - } - - if err := unix.Setns(joiner.fd, 0); err != nil { - return errors.Wrapf(err, "failed to set namespace: %+s", joiner.namespace) - } - - joiner.isJoined = true - logrus.Tracef("Joined namespace: %v", joiner.namespace) - } - return nil -} - // Reset resets all the Joiners. func (joiners *Joiners) Reset() (err error) { for _, joiner := range *joiners { @@ -214,7 +189,7 @@ func (jd *JoinerDescriptor) openAndRecordNamespaceFiles(namespace types.Namespac // The original namespace file is the namespace file of the process thread that is // executing the joiner (e.g. /proc/1/task/2/ns/mnt) func (jd *JoinerDescriptor) openAndRecordOriginalNamespaceFile(ns string, namespace types.Namespace) error { - pthreadFile := filepath.Join("/proc", fmt.Sprint(os.Getpid()), "task", fmt.Sprint(unix.Gettid()), "ns", ns) + pthreadFile := filepath.Join("/proc", fmt.Sprint(os.Getpid()), "task", fmt.Sprint(Gettid()), "ns", ns) originFd, err := jd.origin.OpenFile(pthreadFile) if err != nil { return errors.Wrapf(err, "failed to open process thread file %v", pthreadFile) diff --git a/vendor/github.com/longhorn/go-common-libs/ns/joiner_darwin.go b/vendor/github.com/longhorn/go-common-libs/ns/joiner_darwin.go new file mode 100644 index 000000000..4a2a2e05a --- /dev/null +++ b/vendor/github.com/longhorn/go-common-libs/ns/joiner_darwin.go @@ -0,0 +1,10 @@ +package ns + +// Join joins all the namespaces in the Joiners. +func (joiners *Joiners) Join() (err error) { + return nil +} + +func Gettid() int { + return 0 +} diff --git a/vendor/github.com/longhorn/go-common-libs/ns/joiner_linux.go b/vendor/github.com/longhorn/go-common-libs/ns/joiner_linux.go new file mode 100644 index 000000000..a05ce801f --- /dev/null +++ b/vendor/github.com/longhorn/go-common-libs/ns/joiner_linux.go @@ -0,0 +1,38 @@ +package ns + +import ( + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "golang.org/x/sys/unix" + + "github.com/longhorn/go-common-libs/types" +) + +// Join joins all the namespaces in the Joiners. +func (joiners *Joiners) Join() (err error) { + for _, joiner := range *joiners { + if joiner.isJoined { + logrus.Tracef("Already joined namespace: %s", joiner.namespace) + continue + } + + if joiner.namespace == types.NamespaceMnt { + err := unix.Unshare(unix.CLONE_NEWNS) + if err != nil { + return errors.Wrapf(err, "failed to unshare namespace: %+s", joiner.namespace) + } + } + + if err := unix.Setns(joiner.fd, 0); err != nil { + return errors.Wrapf(err, "failed to set namespace: %+s", joiner.namespace) + } + + joiner.isJoined = true + logrus.Tracef("Joined namespace: %v", joiner.namespace) + } + return nil +} + +func Gettid() int { + return unix.Gettid() +} diff --git a/vendor/github.com/longhorn/go-common-libs/sys/sys.go b/vendor/github.com/longhorn/go-common-libs/sys/sys.go index e4e23a30b..076d3dcce 100644 --- a/vendor/github.com/longhorn/go-common-libs/sys/sys.go +++ b/vendor/github.com/longhorn/go-common-libs/sys/sys.go @@ -6,18 +6,18 @@ import ( "path/filepath" "strconv" "strings" - "syscall" "github.com/pkg/errors" "github.com/sirupsen/logrus" + "golang.org/x/sys/unix" "github.com/longhorn/go-common-libs/types" ) // GetKernelRelease returns the kernel release string. func GetKernelRelease() (string, error) { - utsname := &syscall.Utsname{} - if err := syscall.Uname(utsname); err != nil { + utsname := &unix.Utsname{} + if err := unix.Uname(utsname); err != nil { logrus.WithError(err).Warn("Failed to get kernel release") return "", err } diff --git a/vendor/github.com/longhorn/go-common-libs/types/namespace.go b/vendor/github.com/longhorn/go-common-libs/types/namespace.go index 7358a4076..b0c566232 100644 --- a/vendor/github.com/longhorn/go-common-libs/types/namespace.go +++ b/vendor/github.com/longhorn/go-common-libs/types/namespace.go @@ -2,8 +2,6 @@ package types import ( "time" - - "golang.org/x/sys/unix" ) const ( @@ -28,15 +26,6 @@ const ( NamespaceNet = Namespace("net") ) -func (ns Namespace) Flag() uintptr { - switch ns { - case NamespaceNet: - return unix.CLONE_NEWNET - default: - return 0 - } -} - func (ns Namespace) String() string { return string(ns) } diff --git a/vendor/github.com/longhorn/go-common-libs/types/namespace_darwin.go b/vendor/github.com/longhorn/go-common-libs/types/namespace_darwin.go new file mode 100644 index 000000000..baf5465f6 --- /dev/null +++ b/vendor/github.com/longhorn/go-common-libs/types/namespace_darwin.go @@ -0,0 +1,5 @@ +package types + +func (ns Namespace) Flag() uintptr { + return 0 +} diff --git a/vendor/github.com/longhorn/go-common-libs/types/namespace_linux.go b/vendor/github.com/longhorn/go-common-libs/types/namespace_linux.go new file mode 100644 index 000000000..a0c18fd20 --- /dev/null +++ b/vendor/github.com/longhorn/go-common-libs/types/namespace_linux.go @@ -0,0 +1,14 @@ +package types + +import ( + "golang.org/x/sys/unix" +) + +func (ns Namespace) Flag() uintptr { + switch ns { + case NamespaceNet: + return unix.CLONE_NEWNET + default: + return 0 + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 55867c7d5..fdf81e748 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -178,7 +178,7 @@ github.com/longhorn/backupstore/systembackup github.com/longhorn/backupstore/types github.com/longhorn/backupstore/util github.com/longhorn/backupstore/vfs -# github.com/longhorn/go-common-libs v0.0.0-20240921050101-797b589b669d +# github.com/longhorn/go-common-libs v0.0.0-20240926084818-3a320d860af4 ## explicit; go 1.22.0 github.com/longhorn/go-common-libs/backup github.com/longhorn/go-common-libs/exec @@ -205,7 +205,7 @@ github.com/longhorn/sparse-tools/sparse/rest github.com/longhorn/sparse-tools/stats github.com/longhorn/sparse-tools/types github.com/longhorn/sparse-tools/util -# github.com/longhorn/types v0.0.0-20240902072916-1bf23d310acb +# github.com/longhorn/types v0.0.0-20240925015253-4dae7c529d85 ## explicit; go 1.21 github.com/longhorn/types/pkg/generated/profilerrpc # github.com/mattn/go-colorable v0.1.4