vendor: update github.com/containerd/continuity
Pin it with 1e0d26eb2381594984ee80989c9c229dbd930d9f Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
		
							
								
								
									
										12
									
								
								vendor/github.com/containerd/continuity/fs/copy.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/containerd/continuity/fs/copy.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -18,20 +18,13 @@ package fs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"os"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"github.com/sirupsen/logrus"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var bufferPool = &sync.Pool{
 | 
			
		||||
	New: func() interface{} {
 | 
			
		||||
		buffer := make([]byte, 32*1024)
 | 
			
		||||
		return &buffer
 | 
			
		||||
	},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// XAttrErrorHandler transform a non-nil xattr error.
 | 
			
		||||
// Return nil to ignore an error.
 | 
			
		||||
// xattrKey can be empty for listxattr operation.
 | 
			
		||||
@@ -199,5 +192,6 @@ func openAndCopyFile(target, source string) error {
 | 
			
		||||
	}
 | 
			
		||||
	defer tgt.Close()
 | 
			
		||||
 | 
			
		||||
	return copyFileContent(tgt, src)
 | 
			
		||||
	_, err = io.Copy(tgt, src)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/containerd/continuity/fs/copy_darwin.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/containerd/continuity/fs/copy_darwin.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -25,7 +25,7 @@ import (
 | 
			
		||||
 | 
			
		||||
func copyFile(target, source string) error {
 | 
			
		||||
	if err := unix.Clonefile(source, target, unix.CLONE_NOFOLLOW); err != nil {
 | 
			
		||||
		if !errors.Is(err, unix.ENOTSUP) {
 | 
			
		||||
		if !errors.Is(err, unix.ENOTSUP) && !errors.Is(err, unix.EXDEV) {
 | 
			
		||||
			return fmt.Errorf("clonefile failed: %w", err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										46
									
								
								vendor/github.com/containerd/continuity/fs/copy_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										46
									
								
								vendor/github.com/containerd/continuity/fs/copy_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -18,7 +18,6 @@ package fs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"os"
 | 
			
		||||
	"syscall"
 | 
			
		||||
 | 
			
		||||
@@ -62,51 +61,6 @@ func copyFileInfo(fi os.FileInfo, src, name string) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const maxSSizeT = int64(^uint(0) >> 1)
 | 
			
		||||
 | 
			
		||||
func copyFileContent(dst, src *os.File) error {
 | 
			
		||||
	st, err := src.Stat()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("unable to stat source: %w", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	size := st.Size()
 | 
			
		||||
	first := true
 | 
			
		||||
	srcFd := int(src.Fd())
 | 
			
		||||
	dstFd := int(dst.Fd())
 | 
			
		||||
 | 
			
		||||
	for size > 0 {
 | 
			
		||||
		// Ensure that we are never trying to copy more than SSIZE_MAX at a
 | 
			
		||||
		// time and at the same time avoids overflows when the file is larger
 | 
			
		||||
		// than 4GB on 32-bit systems.
 | 
			
		||||
		var copySize int
 | 
			
		||||
		if size > maxSSizeT {
 | 
			
		||||
			copySize = int(maxSSizeT)
 | 
			
		||||
		} else {
 | 
			
		||||
			copySize = int(size)
 | 
			
		||||
		}
 | 
			
		||||
		n, err := unix.CopyFileRange(srcFd, nil, dstFd, nil, copySize, 0)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			if (err != unix.ENOSYS && err != unix.EXDEV) || !first {
 | 
			
		||||
				return fmt.Errorf("copy file range failed: %w", err)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			buf := bufferPool.Get().(*[]byte)
 | 
			
		||||
			_, err = io.CopyBuffer(dst, src, *buf)
 | 
			
		||||
			bufferPool.Put(buf)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return fmt.Errorf("userspace copy failed: %w", err)
 | 
			
		||||
			}
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		first = false
 | 
			
		||||
		size -= int64(n)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error {
 | 
			
		||||
	xattrKeys, err := sysx.LListxattr(src)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								vendor/github.com/containerd/continuity/fs/copy_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/containerd/continuity/fs/copy_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -21,7 +21,6 @@ package fs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"os"
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"syscall"
 | 
			
		||||
@@ -61,14 +60,6 @@ func copyFileInfo(fi os.FileInfo, src, name string) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func copyFileContent(dst, src *os.File) error {
 | 
			
		||||
	buf := bufferPool.Get().(*[]byte)
 | 
			
		||||
	_, err := io.CopyBuffer(dst, src, *buf)
 | 
			
		||||
	bufferPool.Put(buf)
 | 
			
		||||
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error {
 | 
			
		||||
	xattrKeys, err := sysx.LListxattr(src)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/containerd/continuity/fs/copy_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/containerd/continuity/fs/copy_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -19,7 +19,6 @@ package fs
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"os"
 | 
			
		||||
 | 
			
		||||
	winio "github.com/Microsoft/go-winio"
 | 
			
		||||
@@ -72,13 +71,6 @@ func copyFileInfo(fi os.FileInfo, src, name string) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func copyFileContent(dst, src *os.File) error {
 | 
			
		||||
	buf := bufferPool.Get().(*[]byte)
 | 
			
		||||
	_, err := io.CopyBuffer(dst, src, *buf)
 | 
			
		||||
	bufferPool.Put(buf)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								vendor/github.com/containerd/continuity/fs/fstest/file.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/containerd/continuity/fs/fstest/file.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -65,7 +65,12 @@ func writeFileStream(name string, stream func() io.Reader, perm os.FileMode) App
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		defer func() {
 | 
			
		||||
			err := f.Close()
 | 
			
		||||
			err := f.Sync()
 | 
			
		||||
			if err != nil && retErr == nil {
 | 
			
		||||
				retErr = err
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			err = f.Close()
 | 
			
		||||
			if err != nil && retErr == nil {
 | 
			
		||||
				retErr = err
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user