summaryrefslogtreecommitdiff
path: root/vendor/github.com/containerd/continuity
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/containerd/continuity')
-rw-r--r--vendor/github.com/containerd/continuity/AUTHORS24
-rw-r--r--vendor/github.com/containerd/continuity/fs/copy_darwinopenbsdsolaris.go40
-rw-r--r--vendor/github.com/containerd/continuity/fs/copy_freebsd.go42
-rw-r--r--vendor/github.com/containerd/continuity/fs/copy_unix.go12
-rw-r--r--vendor/github.com/containerd/continuity/fs/du_unix.go22
-rw-r--r--vendor/github.com/containerd/continuity/fs/path.go10
-rw-r--r--vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go12
7 files changed, 133 insertions, 29 deletions
diff --git a/vendor/github.com/containerd/continuity/AUTHORS b/vendor/github.com/containerd/continuity/AUTHORS
index 4043394cc..376ceb93d 100644
--- a/vendor/github.com/containerd/continuity/AUTHORS
+++ b/vendor/github.com/containerd/continuity/AUTHORS
@@ -1,16 +1,40 @@
Aaron Lehmann <aaron.lehmann@docker.com>
Akash Gupta <akagup@microsoft.com>
+Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
+Akihiro Suda <suda.kyoto@gmail.com>
Andrew Pennebaker <apennebaker@datapipe.com>
Brandon Philips <brandon.philips@coreos.com>
+Brian Goff <cpuguy83@gmail.com>
Christopher Jones <tophj@linux.vnet.ibm.com>
Daniel, Dao Quang Minh <dqminh89@gmail.com>
+Darren Stahl <darst@microsoft.com>
+Derek McGowan <derek@mcg.dev>
Derek McGowan <derek@mcgstyle.net>
Edward Pilatowicz <edward.pilatowicz@oracle.com>
Ian Campbell <ijc@docker.com>
+Ivan Markin <sw@nogoegst.net>
Justin Cormack <justin.cormack@docker.com>
Justin Cummins <sul3n3t@gmail.com>
+Kasper Fabæch Brandt <poizan@poizan.dk>
+Kir Kolyshkin <kolyshkin@gmail.com>
+Michael Crosby <crosbymichael@gmail.com>
+Michael Crosby <michael@thepasture.io>
+Michael Wan <zirenwan@gmail.com>
+Mike Brown <brownwm@us.ibm.com>
+Niels de Vos <ndevos@redhat.com>
Phil Estes <estesp@gmail.com>
+Phil Estes <estesp@linux.vnet.ibm.com>
+Samuel Karp <me@samuelkarp.com>
+Sam Whited <sam@samwhited.com>
+Sebastiaan van Stijn <github@gone.nl>
+Shengjing Zhu <zhsj@debian.org>
Stephen J Day <stephen.day@docker.com>
+Tibor Vass <tibor@docker.com>
Tobias Klauser <tklauser@distanz.ch>
+Tom Faulhaber <tffaulha@amazon.com>
Tonis Tiigi <tonistiigi@gmail.com>
+Trevor Porter <trkporter@ucdavis.edu>
+Wei Fu <fuweid89@gmail.com>
+Wilbert van de Ridder <wilbert.ridder@gmail.com>
+Xiaodong Ye <xiaodongy@vmware.com>
diff --git a/vendor/github.com/containerd/continuity/fs/copy_darwinopenbsdsolaris.go b/vendor/github.com/containerd/continuity/fs/copy_darwinopenbsdsolaris.go
new file mode 100644
index 000000000..92ccacf9a
--- /dev/null
+++ b/vendor/github.com/containerd/continuity/fs/copy_darwinopenbsdsolaris.go
@@ -0,0 +1,40 @@
+// +build darwin openbsd solaris
+
+/*
+ Copyright The containerd Authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fs
+
+import (
+ "os"
+ "syscall"
+
+ "github.com/pkg/errors"
+ "golang.org/x/sys/unix"
+)
+
+func copyDevice(dst string, fi os.FileInfo) error {
+ st, ok := fi.Sys().(*syscall.Stat_t)
+ if !ok {
+ return errors.New("unsupported stat type")
+ }
+ return unix.Mknod(dst, uint32(fi.Mode()), int(st.Rdev))
+}
+
+func utimesNano(name string, atime, mtime syscall.Timespec) error {
+ timespec := []syscall.Timespec{atime, mtime}
+ return syscall.UtimesNano(name, timespec)
+}
diff --git a/vendor/github.com/containerd/continuity/fs/copy_freebsd.go b/vendor/github.com/containerd/continuity/fs/copy_freebsd.go
new file mode 100644
index 000000000..4b116c95e
--- /dev/null
+++ b/vendor/github.com/containerd/continuity/fs/copy_freebsd.go
@@ -0,0 +1,42 @@
+// +build freebsd
+
+/*
+ Copyright The containerd Authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package fs
+
+import (
+ "os"
+ "syscall"
+
+ "github.com/pkg/errors"
+ "golang.org/x/sys/unix"
+)
+
+func copyDevice(dst string, fi os.FileInfo) error {
+ st, ok := fi.Sys().(*syscall.Stat_t)
+ if !ok {
+ return errors.New("unsupported stat type")
+ }
+ return unix.Mknod(dst, uint32(fi.Mode()), st.Rdev)
+}
+
+func utimesNano(name string, atime, mtime syscall.Timespec) error {
+ at := unix.NsecToTimespec(atime.Nano())
+ mt := unix.NsecToTimespec(mtime.Nano())
+ utimes := [2]unix.Timespec{at, mt}
+ return unix.UtimesNanoAt(unix.AT_FDCWD, name, utimes[0:], unix.AT_SYMLINK_NOFOLLOW)
+}
diff --git a/vendor/github.com/containerd/continuity/fs/copy_unix.go b/vendor/github.com/containerd/continuity/fs/copy_unix.go
index a5de89261..dfd857aaa 100644
--- a/vendor/github.com/containerd/continuity/fs/copy_unix.go
+++ b/vendor/github.com/containerd/continuity/fs/copy_unix.go
@@ -25,7 +25,6 @@ import (
"github.com/containerd/continuity/sysx"
"github.com/pkg/errors"
- "golang.org/x/sys/unix"
)
func copyFileInfo(fi os.FileInfo, name string) error {
@@ -53,8 +52,7 @@ func copyFileInfo(fi os.FileInfo, name string) error {
}
}
- timespec := []syscall.Timespec{StatAtime(st), StatMtime(st)}
- if err := syscall.UtimesNano(name, timespec); err != nil {
+ if err := utimesNano(name, StatAtime(st), StatMtime(st)); err != nil {
return errors.Wrapf(err, "failed to utime %s", name)
}
@@ -102,11 +100,3 @@ func copyXAttrs(dst, src string, xeh XAttrErrorHandler) error {
return nil
}
-
-func copyDevice(dst string, fi os.FileInfo) error {
- st, ok := fi.Sys().(*syscall.Stat_t)
- if !ok {
- return errors.New("unsupported stat type")
- }
- return unix.Mknod(dst, uint32(fi.Mode()), int(st.Rdev))
-}
diff --git a/vendor/github.com/containerd/continuity/fs/du_unix.go b/vendor/github.com/containerd/continuity/fs/du_unix.go
index e22ffbea3..9da43d1bc 100644
--- a/vendor/github.com/containerd/continuity/fs/du_unix.go
+++ b/vendor/github.com/containerd/continuity/fs/du_unix.go
@@ -25,6 +25,14 @@ import (
"syscall"
)
+// blocksUnitSize is the unit used by `st_blocks` in `stat` in bytes.
+// See https://man7.org/linux/man-pages/man2/stat.2.html
+// st_blocks
+// This field indicates the number of blocks allocated to the
+// file, in 512-byte units. (This may be smaller than
+// st_size/512 when the file has holes.)
+const blocksUnitSize = 512
+
type inode struct {
// TODO(stevvooe): Can probably reduce memory usage by not tracking
// device, but we can leave this right for now.
@@ -33,9 +41,9 @@ type inode struct {
func newInode(stat *syscall.Stat_t) inode {
return inode{
- // Dev is uint32 on darwin/bsd, uint64 on linux/solaris
+ // Dev is uint32 on darwin/bsd, uint64 on linux/solaris/freebsd
dev: uint64(stat.Dev), // nolint: unconvert
- // Ino is uint32 on bsd, uint64 on darwin/linux/solaris
+ // Ino is uint32 on bsd, uint64 on darwin/linux/solaris/freebsd
ino: uint64(stat.Ino), // nolint: unconvert
}
}
@@ -59,10 +67,11 @@ func diskUsage(ctx context.Context, roots ...string) (Usage, error) {
default:
}
- inoKey := newInode(fi.Sys().(*syscall.Stat_t))
+ stat := fi.Sys().(*syscall.Stat_t)
+ inoKey := newInode(stat)
if _, ok := inodes[inoKey]; !ok {
inodes[inoKey] = struct{}{}
- size += fi.Size()
+ size += stat.Blocks * blocksUnitSize
}
return nil
@@ -89,10 +98,11 @@ func diffUsage(ctx context.Context, a, b string) (Usage, error) {
}
if kind == ChangeKindAdd || kind == ChangeKindModify {
- inoKey := newInode(fi.Sys().(*syscall.Stat_t))
+ stat := fi.Sys().(*syscall.Stat_t)
+ inoKey := newInode(stat)
if _, ok := inodes[inoKey]; !ok {
inodes[inoKey] = struct{}{}
- size += fi.Size()
+ size += stat.Blocks * blocksUnitSize
}
return nil
diff --git a/vendor/github.com/containerd/continuity/fs/path.go b/vendor/github.com/containerd/continuity/fs/path.go
index 8863caa9d..c26be7989 100644
--- a/vendor/github.com/containerd/continuity/fs/path.go
+++ b/vendor/github.com/containerd/continuity/fs/path.go
@@ -117,15 +117,13 @@ func sameFile(f1, f2 *currentPath) (bool, error) {
// If the timestamp may have been truncated in both of the
// files, check content of file to determine difference
if t1.Nanosecond() == 0 && t2.Nanosecond() == 0 {
- var eq bool
if (f1.f.Mode() & os.ModeSymlink) == os.ModeSymlink {
- eq, err = compareSymlinkTarget(f1.fullPath, f2.fullPath)
- } else if f1.f.Size() > 0 {
- eq, err = compareFileContent(f1.fullPath, f2.fullPath)
+ return compareSymlinkTarget(f1.fullPath, f2.fullPath)
}
- if err != nil || !eq {
- return eq, err
+ if f1.f.Size() == 0 { // if file sizes are zero length, the files are the same by definition
+ return true, nil
}
+ return compareFileContent(f1.fullPath, f2.fullPath)
} else if t1.Nanosecond() != t2.Nanosecond() {
return false, nil
}
diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go b/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go
index c9ef3a1d2..f8fa8c63f 100644
--- a/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go
+++ b/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go
@@ -23,7 +23,7 @@ import (
"runtime"
)
-var unsupported = errors.New("extended attributes unsupported on " + runtime.GOOS)
+var errUnsupported = errors.New("extended attributes unsupported on " + runtime.GOOS)
// Listxattr calls syscall listxattr and reads all content
// and returns a string array
@@ -33,17 +33,17 @@ func Listxattr(path string) ([]string, error) {
// Removexattr calls syscall removexattr
func Removexattr(path string, attr string) (err error) {
- return unsupported
+ return errUnsupported
}
// Setxattr calls syscall setxattr
func Setxattr(path string, attr string, data []byte, flags int) (err error) {
- return unsupported
+ return errUnsupported
}
// Getxattr calls syscall getxattr
func Getxattr(path, attr string) ([]byte, error) {
- return []byte{}, unsupported
+ return []byte{}, errUnsupported
}
// LListxattr lists xattrs, not following symlinks
@@ -53,12 +53,12 @@ func LListxattr(path string) ([]string, error) {
// LRemovexattr removes an xattr, not following symlinks
func LRemovexattr(path string, attr string) (err error) {
- return unsupported
+ return errUnsupported
}
// LSetxattr sets an xattr, not following symlinks
func LSetxattr(path string, attr string, data []byte, flags int) (err error) {
- return unsupported
+ return errUnsupported
}
// LGetxattr gets an xattr, not following symlinks