From 4d779074b5f10fc0253bac80a159c05f918f8b6c Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat, 28 Sep 2024 03:38:06 +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 eb5550b253..08d837ca0c 100644
--- a/go.mod
+++ b/go.mod
@@ -62,7 +62,7 @@ require (
 	github.com/kubernetes-csi/csi-lib-utils v0.19.0
 	github.com/longhorn/backing-image-manager v1.8.0-dev-20240922
 	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/go-spdk-helper v0.0.0-20240922062342-22115a91cbe9
 	github.com/longhorn/longhorn-engine v1.8.0-dev-20240922
@@ -178,7 +178,7 @@ require (
 	github.com/prometheus/client_model v0.6.1 // indirect
 	github.com/prometheus/common v0.55.0 // indirect
 	github.com/prometheus/procfs v0.15.1 // indirect
-	github.com/rancher/lasso v0.0.0-20240920064621-23f2a336c9b7
+	github.com/rancher/lasso v0.0.0-20240924233157-8f384efc8813
 	github.com/robfig/cron/v3 v3.0.1 // indirect
 	github.com/rogpeppe/go-internal v1.12.0 // indirect
 	github.com/russross/blackfriday/v2 v2.1.0 // indirect
diff --git a/go.sum b/go.sum
index 3feec1d01c..bef362cf14 100644
--- a/go.sum
+++ b/go.sum
@@ -161,8 +161,8 @@ github.com/longhorn/backing-image-manager v1.8.0-dev-20240922 h1:Ikx3UIgHD90DHr1
 github.com/longhorn/backing-image-manager v1.8.0-dev-20240922/go.mod h1:raIdWG9r1P0YlnVRCqsCpavnEHd3TsqREQE2skKNQEA=
 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/go-spdk-helper v0.0.0-20240922062342-22115a91cbe9 h1:DVYw6dzssMcCOAQSqXLVJIQQiKdZD7lAKfnU2ZTf4Mo=
@@ -231,8 +231,8 @@ github.com/rancher/dynamiclistener v0.6.0 h1:M7x8Nq+GY0UORULANuW/AH1ocnyZaqlmTuv
 github.com/rancher/dynamiclistener v0.6.0/go.mod h1:7VNEQhAwzbYJ08S1MYb6B4vili6K7CcrG4cNZXq1j+s=
 github.com/rancher/go-rancher v0.1.1-0.20220412083059-ff12399dd57b h1:so40GMVZOZkQeIbAzaZRq6wDrMErvRLuXNsGTRZUpg8=
 github.com/rancher/go-rancher v0.1.1-0.20220412083059-ff12399dd57b/go.mod h1:7oQvGNiJsGvrUgB+7AH8bmdzuR0uhULfwKb43Ht0hUk=
-github.com/rancher/lasso v0.0.0-20240920064621-23f2a336c9b7 h1:+kWiVtcUSkxOxnW1oIdmuV/MIFzkjacVlkMhZauGp6k=
-github.com/rancher/lasso v0.0.0-20240920064621-23f2a336c9b7/go.mod h1:+GJaJqWpk1MZYCDrMC+4Jee0M/aScoru5T8V2A//rgg=
+github.com/rancher/lasso v0.0.0-20240924233157-8f384efc8813 h1:V/LY8pUHZG9Kc+xEDWDOryOnCU6/Q+Lsr9QQEQnshpU=
+github.com/rancher/lasso v0.0.0-20240924233157-8f384efc8813/go.mod h1:IxgTBO55lziYhTEETyVKiT8/B5Rg92qYiRmcIIYoPgI=
 github.com/rancher/wrangler/v3 v3.0.0 h1:IHHCA+vrghJDPxjtLk4fmeSCFhNe9fFzLFj3m2B0YpA=
 github.com/rancher/wrangler/v3 v3.0.0/go.mod h1:Dfckuuq7MJk2JWVBDywRlZXMxEyPxHy4XqGrPEzu5Eg=
 github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
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 d4ad1c0069..aea7fd4bbe 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 b62e9c9bcd..09c7ace132 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 0000000000..4a2a2e05ad
--- /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 0000000000..a05ce801f9
--- /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 e4e23a30b2..076d3dcce1 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 7358a4076c..b0c5662327 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 0000000000..baf5465f62
--- /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 0000000000..a0c18fd20b
--- /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 b839d2be68..39dba4b485 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -248,7 +248,7 @@ github.com/longhorn/backupstore/logging
 github.com/longhorn/backupstore/systembackup
 github.com/longhorn/backupstore/types
 github.com/longhorn/backupstore/util
-# 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
@@ -390,7 +390,7 @@ github.com/rancher/dynamiclistener/storage/memory
 ## explicit
 github.com/rancher/go-rancher/api
 github.com/rancher/go-rancher/client
-# github.com/rancher/lasso v0.0.0-20240920064621-23f2a336c9b7
+# github.com/rancher/lasso v0.0.0-20240924233157-8f384efc8813
 ## explicit; go 1.22.0
 github.com/rancher/lasso/pkg/cache
 github.com/rancher/lasso/pkg/client