Browse code

vendor: github.com/containerd/continuity v0.4.2

full diff: https://github.com/containerd/continuity/compare/v0.4.1...v0.4.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2023/09/19 01:05:35
Showing 10 changed files
... ...
@@ -27,7 +27,7 @@ require (
27 27
 	github.com/container-orchestrated-devices/container-device-interface v0.6.1
28 28
 	github.com/containerd/cgroups/v3 v3.0.2
29 29
 	github.com/containerd/containerd v1.6.24
30
-	github.com/containerd/continuity v0.4.1
30
+	github.com/containerd/continuity v0.4.2
31 31
 	github.com/containerd/fifo v1.1.0
32 32
 	github.com/containerd/typeurl/v2 v2.1.1
33 33
 	github.com/coreos/go-systemd/v22 v22.5.0
... ...
@@ -367,8 +367,8 @@ github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cE
367 367
 github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y=
368 368
 github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ=
369 369
 github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM=
370
-github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU=
371
-github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ=
370
+github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM=
371
+github.com/containerd/continuity v0.4.2/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ=
372 372
 github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
373 373
 github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
374 374
 github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0=
... ...
@@ -1,5 +1,5 @@
1
-//go:build freebsd
2
-// +build freebsd
1
+//go:build freebsd || dragonfly
2
+// +build freebsd dragonfly
3 3
 
4 4
 /*
5 5
    Copyright The containerd Authors.
... ...
@@ -1,5 +1,5 @@
1
-//go:build darwin || freebsd || netbsd || openbsd || solaris
2
-// +build darwin freebsd netbsd openbsd solaris
1
+//go:build darwin || freebsd || netbsd || openbsd || dragonfly || solaris
2
+// +build darwin freebsd netbsd openbsd dragonfly solaris
3 3
 
4 4
 /*
5 5
    Copyright The containerd Authors.
... ...
@@ -18,20 +18,13 @@ package fs
18 18
 
19 19
 import (
20 20
 	"fmt"
21
+	"io"
21 22
 	"os"
22 23
 	"path/filepath"
23
-	"sync"
24 24
 
25 25
 	"github.com/sirupsen/logrus"
26 26
 )
27 27
 
28
-var bufferPool = &sync.Pool{
29
-	New: func() interface{} {
30
-		buffer := make([]byte, 32*1024)
31
-		return &buffer
32
-	},
33
-}
34
-
35 28
 // XAttrErrorHandler transform a non-nil xattr error.
36 29
 // Return nil to ignore an error.
37 30
 // xattrKey can be empty for listxattr operation.
... ...
@@ -199,5 +192,6 @@ func openAndCopyFile(target, source string) error {
199 199
 	}
200 200
 	defer tgt.Close()
201 201
 
202
-	return copyFileContent(tgt, src)
202
+	_, err = io.Copy(tgt, src)
203
+	return err
203 204
 }
... ...
@@ -18,7 +18,6 @@ package fs
18 18
 
19 19
 import (
20 20
 	"fmt"
21
-	"io"
22 21
 	"os"
23 22
 	"syscall"
24 23
 
... ...
@@ -62,51 +61,6 @@ func copyFileInfo(fi os.FileInfo, src, name string) error {
62 62
 	return nil
63 63
 }
64 64
 
65
-const maxSSizeT = int64(^uint(0) >> 1)
66
-
67
-func copyFileContent(dst, src *os.File) error {
68
-	st, err := src.Stat()
69
-	if err != nil {
70
-		return fmt.Errorf("unable to stat source: %w", err)
71
-	}
72
-
73
-	size := st.Size()
74
-	first := true
75
-	srcFd := int(src.Fd())
76
-	dstFd := int(dst.Fd())
77
-
78
-	for size > 0 {
79
-		// Ensure that we are never trying to copy more than SSIZE_MAX at a
80
-		// time and at the same time avoids overflows when the file is larger
81
-		// than 4GB on 32-bit systems.
82
-		var copySize int
83
-		if size > maxSSizeT {
84
-			copySize = int(maxSSizeT)
85
-		} else {
86
-			copySize = int(size)
87
-		}
88
-		n, err := unix.CopyFileRange(srcFd, nil, dstFd, nil, copySize, 0)
89
-		if err != nil {
90
-			if (err != unix.ENOSYS && err != unix.EXDEV) || !first {
91
-				return fmt.Errorf("copy file range failed: %w", err)
92
-			}
93
-
94
-			buf := bufferPool.Get().(*[]byte)
95
-			_, err = io.CopyBuffer(dst, src, *buf)
96
-			bufferPool.Put(buf)
97
-			if err != nil {
98
-				return fmt.Errorf("userspace copy failed: %w", err)
99
-			}
100
-			return nil
101
-		}
102
-
103
-		first = false
104
-		size -= int64(n)
105
-	}
106
-
107
-	return nil
108
-}
109
-
110 65
 func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error {
111 66
 	xattrKeys, err := sysx.LListxattr(src)
112 67
 	if err != nil {
... ...
@@ -1,5 +1,5 @@
1
-//go:build darwin || freebsd || openbsd || netbsd || solaris
2
-// +build darwin freebsd openbsd netbsd solaris
1
+//go:build darwin || freebsd || openbsd || netbsd || dragonfly || solaris
2
+// +build darwin freebsd openbsd netbsd dragonfly solaris
3 3
 
4 4
 /*
5 5
    Copyright The containerd Authors.
... ...
@@ -21,7 +21,6 @@ package fs
21 21
 
22 22
 import (
23 23
 	"fmt"
24
-	"io"
25 24
 	"os"
26 25
 	"runtime"
27 26
 	"syscall"
... ...
@@ -61,14 +60,6 @@ func copyFileInfo(fi os.FileInfo, src, name string) error {
61 61
 	return nil
62 62
 }
63 63
 
64
-func copyFileContent(dst, src *os.File) error {
65
-	buf := bufferPool.Get().(*[]byte)
66
-	_, err := io.CopyBuffer(dst, src, *buf)
67
-	bufferPool.Put(buf)
68
-
69
-	return err
70
-}
71
-
72 64
 func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error {
73 65
 	xattrKeys, err := sysx.LListxattr(src)
74 66
 	if err != nil {
... ...
@@ -19,7 +19,6 @@ package fs
19 19
 import (
20 20
 	"errors"
21 21
 	"fmt"
22
-	"io"
23 22
 	"os"
24 23
 
25 24
 	winio "github.com/Microsoft/go-winio"
... ...
@@ -72,13 +71,6 @@ func copyFileInfo(fi os.FileInfo, src, name string) error {
72 72
 	return nil
73 73
 }
74 74
 
75
-func copyFileContent(dst, src *os.File) error {
76
-	buf := bufferPool.Get().(*[]byte)
77
-	_, err := io.CopyBuffer(dst, src, *buf)
78
-	bufferPool.Put(buf)
79
-	return err
80
-}
81
-
82 75
 func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error {
83 76
 	return nil
84 77
 }
... ...
@@ -1,5 +1,5 @@
1
-//go:build linux || openbsd || solaris
2
-// +build linux openbsd solaris
1
+//go:build linux || openbsd || dragonfly || solaris
2
+// +build linux openbsd dragonfly solaris
3 3
 
4 4
 /*
5 5
    Copyright The containerd Authors.
... ...
@@ -322,7 +322,7 @@ github.com/containerd/containerd/sys
322 322
 github.com/containerd/containerd/sys/reaper
323 323
 github.com/containerd/containerd/tracing
324 324
 github.com/containerd/containerd/version
325
-# github.com/containerd/continuity v0.4.1
325
+# github.com/containerd/continuity v0.4.2
326 326
 ## explicit; go 1.19
327 327
 github.com/containerd/continuity/devices
328 328
 github.com/containerd/continuity/driver