From 47637f2aa2a29aa4d4d6646505ccbabffdc3c14f Mon Sep 17 00:00:00 2001 From: Edward Pilatowicz Date: Tue, 25 Jul 2017 16:55:47 -0700 Subject: [PATCH] vendor: update github.com/containerd/continuity Signed-off-by: Edward Pilatowicz --- vendor.conf | 2 +- .../containerd/continuity/README.md | 61 ++++++++++++- .../containerd/continuity/context.go | 60 +++++++------ .../containerd/continuity/devices/devices.go | 5 ++ .../{ => devices}/devices_darwin.go | 2 +- .../continuity/devices/devices_dummy.go | 23 +++++ .../{ => devices}/devices_freebsd.go | 2 +- .../continuity/{ => devices}/devices_linux.go | 2 +- .../continuity/devices/devices_solaris.go | 18 ++++ .../continuity/{ => devices}/devices_unix.go | 8 +- .../{ => devices}/devices_windows.go | 4 +- .../continuity/{ => driver}/driver.go | 52 +++++++++--- .../continuity/{ => driver}/driver_unix.go | 11 +-- .../continuity/{ => driver}/driver_windows.go | 2 +- .../containerd/continuity/hardlinks_unix.go | 2 +- .../continuity/pathdriver/path_driver.go | 85 +++++++++++++++++++ .../continuity/proto/manifest.pb.go | 4 +- .../continuity/proto/manifest.proto | 8 +- .../containerd/continuity/resource_unix.go | 2 +- .../continuity/sysx/chmod_solaris.go | 11 +++ .../containerd/continuity/sysx/copy_linux.go | 2 + .../continuity/sysx/copy_linux_ppc64le.go | 20 +++++ .../continuity/sysx/copy_linux_s390x.go | 20 +++++ .../continuity/sysx/nodata_solaris.go | 8 ++ .../continuity/sysx/sysnum_linux_ppc64le.go | 7 ++ .../continuity/sysx/sysnum_linux_s390x.go | 7 ++ .../continuity/sysx/xattr_freebsd.go | 43 +--------- .../continuity/sysx/xattr_solaris.go | 12 +++ .../continuity/sysx/xattr_unsupported.go | 44 ++++++++++ 29 files changed, 423 insertions(+), 104 deletions(-) create mode 100644 vendor/github.com/containerd/continuity/devices/devices.go rename vendor/github.com/containerd/continuity/{ => devices}/devices_darwin.go (92%) create mode 100644 vendor/github.com/containerd/continuity/devices/devices_dummy.go rename vendor/github.com/containerd/continuity/{ => devices}/devices_freebsd.go (92%) rename vendor/github.com/containerd/continuity/{ => devices}/devices_linux.go (92%) create mode 100644 vendor/github.com/containerd/continuity/devices/devices_solaris.go rename vendor/github.com/containerd/continuity/{ => devices}/devices_unix.go (83%) rename vendor/github.com/containerd/continuity/{ => devices}/devices_windows.go (62%) rename vendor/github.com/containerd/continuity/{ => driver}/driver.go (78%) rename vendor/github.com/containerd/continuity/{ => driver}/driver_unix.go (93%) rename vendor/github.com/containerd/continuity/{ => driver}/driver_windows.go (96%) create mode 100644 vendor/github.com/containerd/continuity/pathdriver/path_driver.go create mode 100644 vendor/github.com/containerd/continuity/sysx/chmod_solaris.go create mode 100644 vendor/github.com/containerd/continuity/sysx/copy_linux_ppc64le.go create mode 100644 vendor/github.com/containerd/continuity/sysx/copy_linux_s390x.go create mode 100644 vendor/github.com/containerd/continuity/sysx/nodata_solaris.go create mode 100644 vendor/github.com/containerd/continuity/sysx/sysnum_linux_ppc64le.go create mode 100644 vendor/github.com/containerd/continuity/sysx/sysnum_linux_s390x.go create mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_solaris.go create mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go diff --git a/vendor.conf b/vendor.conf index 6cfde9750..07114fe68 100644 --- a/vendor.conf +++ b/vendor.conf @@ -29,7 +29,7 @@ github.com/pkg/errors v0.8.0 github.com/opencontainers/go-digest 21dfd564fd89c944783d00d069f33e3e7123c448 golang.org/x/sys 739734461d1c916b6c72a63d7efda2b27edb369f https://github.com/golang/sys github.com/opencontainers/image-spec v1.0.0 -github.com/containerd/continuity 86cec1535a968310e7532819f699ff2830ed7463 +github.com/containerd/continuity cf279e6ac893682272b4479d4c67fd3abf878b4e golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c github.com/BurntSushi/toml v0.2.0-21-g9906417 github.com/grpc-ecosystem/go-grpc-prometheus 6b7015e65d366bf3f19b2b2a000a831940f0f7e0 diff --git a/vendor/github.com/containerd/continuity/README.md b/vendor/github.com/containerd/continuity/README.md index 50b64c20f..0e91ce07b 100644 --- a/vendor/github.com/containerd/continuity/README.md +++ b/vendor/github.com/containerd/continuity/README.md @@ -10,10 +10,65 @@ metadata storage. Please see https://github.com/opencontainers/specs/issues/11 for more details. -## Building Proto Package +## Manifest Format + +A continuity manifest encodes filesystem metadata in Protocol Buffers. +Please refer to [proto/manifest.proto](proto/manifest.proto). + +## Usage + +Build: + +```console +$ make +``` + +Create a manifest (of this repo itself): + +```console +$ ./bin/continuity build . > /tmp/a.pb +``` + +Dump a manifest: + +```console +$ ./bin/continuity ls /tmp/a.pb +... +-rw-rw-r-- 270 B /.gitignore +-rw-rw-r-- 88 B /.mailmap +-rw-rw-r-- 187 B /.travis.yml +-rw-rw-r-- 359 B /AUTHORS +-rw-rw-r-- 11 kB /LICENSE +-rw-rw-r-- 1.5 kB /Makefile +... +-rw-rw-r-- 986 B /testutil_test.go +drwxrwxr-x 0 B /version +-rw-rw-r-- 478 B /version/version.go +``` + +Verify a manifest: + +```console +$ ./bin/continuity verify . /tmp/a.pb +``` + +Break the directory and restore using the manifest: +```console +$ chmod 777 Makefile +$ ./bin/continuity verify . /tmp/a.pb +2017/06/23 08:00:34 error verifying manifest: resource "/Makefile" has incorrect mode: -rwxrwxrwx != -rw-rw-r-- +$ ./bin/continuity apply . /tmp/a.pb +$ stat -c %a Makefile +664 +$ ./bin/continuity verify . /tmp/a.pb +``` + + +## Contribution Guide +### Building Proto Package If you change the proto file you will need to rebuild the generated Go with `go generate`. -``` -go generate ./proto +```console +$ go generate ./proto ``` diff --git a/vendor/github.com/containerd/continuity/context.go b/vendor/github.com/containerd/continuity/context.go index 9e72fd0b0..2667a97df 100644 --- a/vendor/github.com/containerd/continuity/context.go +++ b/vendor/github.com/containerd/continuity/context.go @@ -9,6 +9,9 @@ import ( "path/filepath" "strings" + "github.com/containerd/continuity/devices" + driverpkg "github.com/containerd/continuity/driver" + "github.com/containerd/continuity/pathdriver" "github.com/opencontainers/go-digest" ) @@ -34,19 +37,21 @@ type Context interface { type SymlinkPath func(root, linkname, target string) (string, error) type ContextOptions struct { - Digester Digester - Driver Driver - Provider ContentProvider + Digester Digester + Driver driverpkg.Driver + PathDriver pathdriver.PathDriver + Provider ContentProvider } // context represents a file system context for accessing resources. // Generally, all path qualified access and system considerations should land // here. type context struct { - driver Driver - root string - digester Digester - provider ContentProvider + driver driverpkg.Driver + pathDriver pathdriver.PathDriver + root string + digester Digester + provider ContentProvider } // NewContext returns a Context associated with root. The default driver will @@ -58,14 +63,20 @@ func NewContext(root string) (Context, error) { // NewContextWithOptions returns a Context associate with the root. func NewContextWithOptions(root string, options ContextOptions) (Context, error) { // normalize to absolute path - root, err := filepath.Abs(filepath.Clean(root)) + pathDriver := options.PathDriver + if pathDriver == nil { + pathDriver = pathdriver.LocalPathDriver + } + + root = pathDriver.FromSlash(root) + root, err := pathDriver.Abs(pathDriver.Clean(root)) if err != nil { return nil, err } driver := options.Driver if driver == nil { - driver, err = NewSystemDriver() + driver, err = driverpkg.NewSystemDriver() if err != nil { return nil, err } @@ -90,10 +101,11 @@ func NewContextWithOptions(root string, options ContextOptions) (Context, error) } return &context{ - root: root, - driver: driver, - digester: digester, - provider: options.Provider, + root: root, + driver: driver, + pathDriver: pathDriver, + digester: digester, + provider: options.Provider, }, nil } @@ -158,7 +170,7 @@ func (c *context) Resource(p string, fi os.FileInfo) (Resource, error) { } if fi.Mode()&os.ModeDevice != 0 { - deviceDriver, ok := c.driver.(DeviceInfoDriver) + deviceDriver, ok := c.driver.(driverpkg.DeviceInfoDriver) if !ok { log.Printf("device extraction not supported %s", fp) return nil, ErrNotSupported @@ -473,7 +485,7 @@ func (c *context) Apply(resource Resource) error { } else if (fi.Mode() & os.ModeDevice) == 0 { return fmt.Errorf("%q should be a device, but is not", resource.Path()) } else { - major, minor, err := deviceInfo(fi) + major, minor, err := devices.DeviceInfo(fi) if err != nil { return err } @@ -535,7 +547,7 @@ func (c *context) Apply(resource Resource) error { // we only set xattres defined by resource but never remove. if _, ok := resource.(SymLink); ok { - lxattrDriver, ok := c.driver.(LXAttrDriver) + lxattrDriver, ok := c.driver.(driverpkg.LXAttrDriver) if !ok { return fmt.Errorf("unsupported symlink xattr for resource %q", resource.Path()) } @@ -543,7 +555,7 @@ func (c *context) Apply(resource Resource) error { return err } } else { - xattrDriver, ok := c.driver.(XAttrDriver) + xattrDriver, ok := c.driver.(driverpkg.XAttrDriver) if !ok { return fmt.Errorf("unsupported xattr for resource %q", resource.Path()) } @@ -560,7 +572,7 @@ func (c *context) Apply(resource Resource) error { // the context. Otherwise identical to filepath.Walk, the path argument is // corrected to be contained within the context. func (c *context) Walk(fn filepath.WalkFunc) error { - return filepath.Walk(c.root, func(p string, fi os.FileInfo, err error) error { + return c.pathDriver.Walk(c.root, func(p string, fi os.FileInfo, err error) error { contained, err := c.contain(p) return fn(contained, fi, err) }) @@ -569,7 +581,7 @@ func (c *context) Walk(fn filepath.WalkFunc) error { // fullpath returns the system path for the resource, joined with the context // root. The path p must be a part of the context. func (c *context) fullpath(p string) (string, error) { - p = filepath.Join(c.root, p) + p = c.pathDriver.Join(c.root, p) if !strings.HasPrefix(p, c.root) { return "", fmt.Errorf("invalid context path") } @@ -580,19 +592,19 @@ func (c *context) fullpath(p string) (string, error) { // contain cleans and santizes the filesystem path p to be an absolute path, // effectively relative to the context root. func (c *context) contain(p string) (string, error) { - sanitized, err := filepath.Rel(c.root, p) + sanitized, err := c.pathDriver.Rel(c.root, p) if err != nil { return "", err } // ZOMBIES(stevvooe): In certain cases, we may want to remap these to a // "containment error", so the caller can decide what to do. - return filepath.Join("/", filepath.Clean(sanitized)), nil + return c.pathDriver.Join("/", c.pathDriver.Clean(sanitized)), nil } // digest returns the digest of the file at path p, relative to the root. func (c *context) digest(p string) (digest.Digest, error) { - f, err := c.driver.Open(filepath.Join(c.root, p)) + f, err := c.driver.Open(c.pathDriver.Join(c.root, p)) if err != nil { return "", err } @@ -606,7 +618,7 @@ func (c *context) digest(p string) (digest.Digest, error) { // cannot have xattrs, nil will be returned. func (c *context) resolveXAttrs(fp string, fi os.FileInfo, base *resource) (map[string][]byte, error) { if fi.Mode().IsRegular() || fi.Mode().IsDir() { - xattrDriver, ok := c.driver.(XAttrDriver) + xattrDriver, ok := c.driver.(driverpkg.XAttrDriver) if !ok { log.Println("xattr extraction not supported") return nil, ErrNotSupported @@ -616,7 +628,7 @@ func (c *context) resolveXAttrs(fp string, fi os.FileInfo, base *resource) (map[ } if fi.Mode()&os.ModeSymlink != 0 { - lxattrDriver, ok := c.driver.(LXAttrDriver) + lxattrDriver, ok := c.driver.(driverpkg.LXAttrDriver) if !ok { log.Println("xattr extraction for symlinks not supported") return nil, ErrNotSupported diff --git a/vendor/github.com/containerd/continuity/devices/devices.go b/vendor/github.com/containerd/continuity/devices/devices.go new file mode 100644 index 000000000..708640704 --- /dev/null +++ b/vendor/github.com/containerd/continuity/devices/devices.go @@ -0,0 +1,5 @@ +package devices + +import "fmt" + +var ErrNotSupported = fmt.Errorf("not supported") diff --git a/vendor/github.com/containerd/continuity/devices_darwin.go b/vendor/github.com/containerd/continuity/devices/devices_darwin.go similarity index 92% rename from vendor/github.com/containerd/continuity/devices_darwin.go rename to vendor/github.com/containerd/continuity/devices/devices_darwin.go index 864162f5d..5041e6661 100644 --- a/vendor/github.com/containerd/continuity/devices_darwin.go +++ b/vendor/github.com/containerd/continuity/devices/devices_darwin.go @@ -1,4 +1,4 @@ -package continuity +package devices // from /usr/include/sys/types.h diff --git a/vendor/github.com/containerd/continuity/devices/devices_dummy.go b/vendor/github.com/containerd/continuity/devices/devices_dummy.go new file mode 100644 index 000000000..9a48330a5 --- /dev/null +++ b/vendor/github.com/containerd/continuity/devices/devices_dummy.go @@ -0,0 +1,23 @@ +// +build solaris,!cgo + +// +// Implementing the functions below requires cgo support. Non-cgo stubs +// versions are defined below to enable cross-compilation of source code +// that depends on these functions, but the resultant cross-compiled +// binaries cannot actually be used. If the stub function(s) below are +// actually invoked they will cause the calling process to exit. +// + +package devices + +func getmajor(dev uint64) uint64 { + panic("getmajor() support requires cgo.") +} + +func getminor(dev uint64) uint64 { + panic("getminor() support requires cgo.") +} + +func makedev(major int, minor int) int { + panic("makedev() support requires cgo.") +} diff --git a/vendor/github.com/containerd/continuity/devices_freebsd.go b/vendor/github.com/containerd/continuity/devices/devices_freebsd.go similarity index 92% rename from vendor/github.com/containerd/continuity/devices_freebsd.go rename to vendor/github.com/containerd/continuity/devices/devices_freebsd.go index 2b32fc5da..a5c7b9318 100644 --- a/vendor/github.com/containerd/continuity/devices_freebsd.go +++ b/vendor/github.com/containerd/continuity/devices/devices_freebsd.go @@ -1,4 +1,4 @@ -package continuity +package devices // from /usr/include/sys/types.h diff --git a/vendor/github.com/containerd/continuity/devices_linux.go b/vendor/github.com/containerd/continuity/devices/devices_linux.go similarity index 92% rename from vendor/github.com/containerd/continuity/devices_linux.go rename to vendor/github.com/containerd/continuity/devices/devices_linux.go index f47fd8abf..454cf668f 100644 --- a/vendor/github.com/containerd/continuity/devices_linux.go +++ b/vendor/github.com/containerd/continuity/devices/devices_linux.go @@ -1,4 +1,4 @@ -package continuity +package devices // from /usr/include/linux/kdev_t.h diff --git a/vendor/github.com/containerd/continuity/devices/devices_solaris.go b/vendor/github.com/containerd/continuity/devices/devices_solaris.go new file mode 100644 index 000000000..8819ac82f --- /dev/null +++ b/vendor/github.com/containerd/continuity/devices/devices_solaris.go @@ -0,0 +1,18 @@ +// +build cgo + +package devices + +//#include +import "C" + +func getmajor(dev uint64) uint64 { + return uint64(C.major(C.dev_t(dev))) +} + +func getminor(dev uint64) uint64 { + return uint64(C.minor(C.dev_t(dev))) +} + +func makedev(major int, minor int) int { + return int(C.makedev(C.major_t(major), C.minor_t(minor))) +} diff --git a/vendor/github.com/containerd/continuity/devices_unix.go b/vendor/github.com/containerd/continuity/devices/devices_unix.go similarity index 83% rename from vendor/github.com/containerd/continuity/devices_unix.go rename to vendor/github.com/containerd/continuity/devices/devices_unix.go index bb77962ef..85e9a68c4 100644 --- a/vendor/github.com/containerd/continuity/devices_unix.go +++ b/vendor/github.com/containerd/continuity/devices/devices_unix.go @@ -1,6 +1,6 @@ -// +build linux darwin freebsd +// +build linux darwin freebsd solaris -package continuity +package devices import ( "fmt" @@ -8,7 +8,7 @@ import ( "syscall" ) -func deviceInfo(fi os.FileInfo) (uint64, uint64, error) { +func DeviceInfo(fi os.FileInfo) (uint64, uint64, error) { sys, ok := fi.Sys().(*syscall.Stat_t) if !ok { return 0, 0, fmt.Errorf("cannot extract device from os.FileInfo") @@ -18,7 +18,7 @@ func deviceInfo(fi os.FileInfo) (uint64, uint64, error) { } // mknod provides a shortcut for syscall.Mknod -func mknod(p string, mode os.FileMode, maj, min int) error { +func Mknod(p string, mode os.FileMode, maj, min int) error { var ( m = syscallMode(mode.Perm()) dev int diff --git a/vendor/github.com/containerd/continuity/devices_windows.go b/vendor/github.com/containerd/continuity/devices/devices_windows.go similarity index 62% rename from vendor/github.com/containerd/continuity/devices_windows.go rename to vendor/github.com/containerd/continuity/devices/devices_windows.go index 3e7753aec..6099d1d77 100644 --- a/vendor/github.com/containerd/continuity/devices_windows.go +++ b/vendor/github.com/containerd/continuity/devices/devices_windows.go @@ -1,4 +1,4 @@ -package continuity +package devices import ( "os" @@ -6,6 +6,6 @@ import ( "github.com/pkg/errors" ) -func deviceInfo(fi os.FileInfo) (uint64, uint64, error) { +func DeviceInfo(fi os.FileInfo) (uint64, uint64, error) { return 0, 0, errors.Wrap(ErrNotSupported, "cannot get device info on windows") } diff --git a/vendor/github.com/containerd/continuity/driver.go b/vendor/github.com/containerd/continuity/driver/driver.go similarity index 78% rename from vendor/github.com/containerd/continuity/driver.go rename to vendor/github.com/containerd/continuity/driver/driver.go index 8afa95809..aa1dd7d29 100644 --- a/vendor/github.com/containerd/continuity/driver.go +++ b/vendor/github.com/containerd/continuity/driver/driver.go @@ -1,9 +1,13 @@ -package continuity +package driver import ( + "fmt" + "io" "os" ) +var ErrNotSupported = fmt.Errorf("not supported") + // Driver provides all of the system-level functions in a common interface. // The context should call these with full paths and should never use the `os` // package or any other package to access resources on the filesystem. This @@ -15,7 +19,12 @@ import ( // example, it is not required to wrap os.FileInfo to return correct paths for // the call to Name(). type Driver interface { - Open(path string) (*os.File, error) + // Note that Open() returns a File interface instead of *os.File. This + // is because os.File is a struct, so if Open was to return *os.File, + // the only way to fulfill the interface would be to call os.Open() + Open(path string) (File, error) + OpenFile(path string, flag int, perm os.FileMode) (File, error) + Stat(path string) (os.FileInfo, error) Lstat(path string) (os.FileInfo, error) Readlink(p string) (string, error) @@ -27,20 +36,22 @@ type Driver interface { Lchown(path string, uid, gid int64) error Symlink(oldname, newname string) error + MkdirAll(path string, perm os.FileMode) error + RemoveAll(path string) error + // TODO(aaronl): These methods might move outside the main Driver // interface in the future as more platforms are added. Mknod(path string, mode os.FileMode, major int, minor int) error Mkfifo(path string, mode os.FileMode) error +} - // NOTE(stevvooe): We may want to actually include the path manipulation - // functions here, as well. They have been listed below to make the - // discovery process easier. - - // Join(path ...string) string - // IsAbs(string) bool - // Abs(string) (string, error) - // Rel(base, target string) (string, error) - // Walk(string, filepath.WalkFunc) error +// File is the interface for interacting with files returned by continuity's Open +// This is needed since os.File is a struct, instead of an interface, so it can't +// be used. +type File interface { + io.ReadWriteCloser + io.Seeker + Readdir(n int) ([]os.FileInfo, error) } func NewSystemDriver() (Driver, error) { @@ -90,12 +101,19 @@ type DeviceInfoDriver interface { // such as xattrs, which can add support at compile time. type driver struct{} -var _ Driver = &driver{} +var _ File = &os.File{} -func (d *driver) Open(p string) (*os.File, error) { +// LocalDriver is the exported Driver struct for convenience. +var LocalDriver Driver = &driver{} + +func (d *driver) Open(p string) (File, error) { return os.Open(p) } +func (d *driver) OpenFile(path string, flag int, perm os.FileMode) (File, error) { + return os.OpenFile(path, flag, perm) +} + func (d *driver) Stat(p string) (os.FileInfo, error) { return os.Stat(p) } @@ -134,3 +152,11 @@ func (d *driver) Lchown(name string, uid, gid int64) error { func (d *driver) Symlink(oldname, newname string) error { return os.Symlink(oldname, newname) } + +func (d *driver) MkdirAll(path string, perm os.FileMode) error { + return os.MkdirAll(path, perm) +} + +func (d *driver) RemoveAll(path string) error { + return os.RemoveAll(path) +} diff --git a/vendor/github.com/containerd/continuity/driver_unix.go b/vendor/github.com/containerd/continuity/driver/driver_unix.go similarity index 93% rename from vendor/github.com/containerd/continuity/driver_unix.go rename to vendor/github.com/containerd/continuity/driver/driver_unix.go index 85d54eba1..d9ab1656c 100644 --- a/vendor/github.com/containerd/continuity/driver_unix.go +++ b/vendor/github.com/containerd/continuity/driver/driver_unix.go @@ -1,6 +1,6 @@ -// +build linux darwin freebsd +// +build linux darwin freebsd solaris -package continuity +package driver import ( "errors" @@ -9,11 +9,12 @@ import ( "path/filepath" "sort" + "github.com/containerd/continuity/devices" "github.com/containerd/continuity/sysx" ) func (d *driver) Mknod(path string, mode os.FileMode, major, minor int) error { - return mknod(path, mode, major, minor) + return devices.Mknod(path, mode, major, minor) } func (d *driver) Mkfifo(path string, mode os.FileMode) error { @@ -22,7 +23,7 @@ func (d *driver) Mkfifo(path string, mode os.FileMode) error { } // mknod with a mode that has ModeNamedPipe set creates a fifo, not a // device. - return mknod(path, mode, 0, 0) + return devices.Mknod(path, mode, 0, 0) } // Lchmod changes the mode of an file not following symlinks. @@ -117,5 +118,5 @@ func (d *driver) LSetxattr(path string, attrMap map[string][]byte) error { } func (d *driver) DeviceInfo(fi os.FileInfo) (maj uint64, min uint64, err error) { - return deviceInfo(fi) + return devices.DeviceInfo(fi) } diff --git a/vendor/github.com/containerd/continuity/driver_windows.go b/vendor/github.com/containerd/continuity/driver/driver_windows.go similarity index 96% rename from vendor/github.com/containerd/continuity/driver_windows.go rename to vendor/github.com/containerd/continuity/driver/driver_windows.go index a2cda2049..e4cfa64fb 100644 --- a/vendor/github.com/containerd/continuity/driver_windows.go +++ b/vendor/github.com/containerd/continuity/driver/driver_windows.go @@ -1,4 +1,4 @@ -package continuity +package driver import ( "os" diff --git a/vendor/github.com/containerd/continuity/hardlinks_unix.go b/vendor/github.com/containerd/continuity/hardlinks_unix.go index 0759b525e..1d81a3f96 100644 --- a/vendor/github.com/containerd/continuity/hardlinks_unix.go +++ b/vendor/github.com/containerd/continuity/hardlinks_unix.go @@ -1,4 +1,4 @@ -// +build linux darwin freebsd +// +build linux darwin freebsd solaris package continuity diff --git a/vendor/github.com/containerd/continuity/pathdriver/path_driver.go b/vendor/github.com/containerd/continuity/pathdriver/path_driver.go new file mode 100644 index 000000000..b43d55fe9 --- /dev/null +++ b/vendor/github.com/containerd/continuity/pathdriver/path_driver.go @@ -0,0 +1,85 @@ +package pathdriver + +import ( + "path/filepath" +) + +// PathDriver provides all of the path manipulation functions in a common +// interface. The context should call these and never use the `filepath` +// package or any other package to manipulate paths. +type PathDriver interface { + Join(paths ...string) string + IsAbs(path string) bool + Rel(base, target string) (string, error) + Base(path string) string + Dir(path string) string + Clean(path string) string + Split(path string) (dir, file string) + Separator() byte + Abs(path string) (string, error) + Walk(string, filepath.WalkFunc) error + FromSlash(path string) string + ToSlash(path string) string + Match(pattern, name string) (matched bool, err error) +} + +// pathDriver is a simple default implementation calls the filepath package. +type pathDriver struct{} + +// LocalPathDriver is the exported pathDriver struct for convenience. +var LocalPathDriver PathDriver = &pathDriver{} + +func (*pathDriver) Join(paths ...string) string { + return filepath.Join(paths...) +} + +func (*pathDriver) IsAbs(path string) bool { + return filepath.IsAbs(path) +} + +func (*pathDriver) Rel(base, target string) (string, error) { + return filepath.Rel(base, target) +} + +func (*pathDriver) Base(path string) string { + return filepath.Base(path) +} + +func (*pathDriver) Dir(path string) string { + return filepath.Dir(path) +} + +func (*pathDriver) Clean(path string) string { + return filepath.Clean(path) +} + +func (*pathDriver) Split(path string) (dir, file string) { + return filepath.Split(path) +} + +func (*pathDriver) Separator() byte { + return filepath.Separator +} + +func (*pathDriver) Abs(path string) (string, error) { + return filepath.Abs(path) +} + +// Note that filepath.Walk calls os.Stat, so if the context wants to +// to call Driver.Stat() for Walk, they need to create a new struct that +// overrides this method. +func (*pathDriver) Walk(root string, walkFn filepath.WalkFunc) error { + return filepath.Walk(root, walkFn) +} + +func (*pathDriver) FromSlash(path string) string { + return filepath.FromSlash(path) +} + +func (*pathDriver) ToSlash(path string) string { + return filepath.ToSlash(path) +} + +func (*pathDriver) Match(pattern, name string) (bool, error) { + return filepath.Match(pattern, name) +} diff --git a/vendor/github.com/containerd/continuity/proto/manifest.pb.go b/vendor/github.com/containerd/continuity/proto/manifest.pb.go index 05107c1db..3e575107d 100644 --- a/vendor/github.com/containerd/continuity/proto/manifest.pb.go +++ b/vendor/github.com/containerd/continuity/proto/manifest.pb.go @@ -71,7 +71,9 @@ type Resource struct { // for regular files. Size uint64 `protobuf:"varint,7,opt,name=size" json:"size,omitempty"` // Digest specifies the content digest of the target file. Only valid for - // regular files. The strings are formatted as :. + // regular files. The strings are formatted in OCI style, i.e. :. + // For detailed information about the format, please refer to OCI Image Spec: + // https://github.com/opencontainers/image-spec/blob/master/descriptor.md#digests-and-verification // The digests are sorted in lexical order and implementations may choose // which algorithms they prefer. Digest []string `protobuf:"bytes,8,rep,name=digest" json:"digest,omitempty"` diff --git a/vendor/github.com/containerd/continuity/proto/manifest.proto b/vendor/github.com/containerd/continuity/proto/manifest.proto index 844ea791f..e2e110f11 100644 --- a/vendor/github.com/containerd/continuity/proto/manifest.proto +++ b/vendor/github.com/containerd/continuity/proto/manifest.proto @@ -24,8 +24,8 @@ message Resource { // user and group are not currently used but their field numbers have been // reserved for future use. As such, they are marked as deprecated. - string user = 4 [deprecated=true]; - string group = 5 [deprecated=true]; + string user = 4 [deprecated=true]; // "deprecated" stands for "reserved" here + string group = 5 [deprecated=true]; // "deprecated" stands for "reserved" here // Mode defines the file mode and permissions. We've used the same // bit-packing from Go's os package, @@ -40,7 +40,9 @@ message Resource { uint64 size = 7; // Digest specifies the content digest of the target file. Only valid for - // regular files. The strings are formatted as :. + // regular files. The strings are formatted in OCI style, i.e. :. + // For detailed information about the format, please refer to OCI Image Spec: + // https://github.com/opencontainers/image-spec/blob/master/descriptor.md#digests-and-verification // The digests are sorted in lexical order and implementations may choose // which algorithms they prefer. repeated string digest = 8; diff --git a/vendor/github.com/containerd/continuity/resource_unix.go b/vendor/github.com/containerd/continuity/resource_unix.go index d1006cb41..4144643e0 100644 --- a/vendor/github.com/containerd/continuity/resource_unix.go +++ b/vendor/github.com/containerd/continuity/resource_unix.go @@ -1,4 +1,4 @@ -// +build linux darwin freebsd +// +build linux darwin freebsd solaris package continuity diff --git a/vendor/github.com/containerd/continuity/sysx/chmod_solaris.go b/vendor/github.com/containerd/continuity/sysx/chmod_solaris.go new file mode 100644 index 000000000..3ba6e5edc --- /dev/null +++ b/vendor/github.com/containerd/continuity/sysx/chmod_solaris.go @@ -0,0 +1,11 @@ +package sysx + +import "golang.org/x/sys/unix" + +const ( + AtSymlinkNofollow = unix.AT_SYMLINK_NOFOLLOW +) + +func Fchmodat(dirfd int, path string, mode uint32, flags int) error { + return unix.Fchmodat(dirfd, path, mode, flags) +} diff --git a/vendor/github.com/containerd/continuity/sysx/copy_linux.go b/vendor/github.com/containerd/continuity/sysx/copy_linux.go index d7ccbb26e..4d8581284 100644 --- a/vendor/github.com/containerd/continuity/sysx/copy_linux.go +++ b/vendor/github.com/containerd/continuity/sysx/copy_linux.go @@ -5,5 +5,7 @@ package sysx // $ GOOS=linux GOARCH=amd64 ./generate.sh copy // $ GOOS=linux GOARCH=arm ./generate.sh copy // $ GOOS=linux GOARCH=arm64 ./generate.sh copy +// $ GOOS=linux GOARCH=ppc64le ./generate.sh copy +// $ GOOS=linux GOARCH=s390x ./generate.sh copy //sys CopyFileRange(fdin uintptr, offin *int64, fdout uintptr, offout *int64, len int, flags int) (n int, err error) diff --git a/vendor/github.com/containerd/continuity/sysx/copy_linux_ppc64le.go b/vendor/github.com/containerd/continuity/sysx/copy_linux_ppc64le.go new file mode 100644 index 000000000..9941b01f0 --- /dev/null +++ b/vendor/github.com/containerd/continuity/sysx/copy_linux_ppc64le.go @@ -0,0 +1,20 @@ +// mksyscall.pl copy_linux.go +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + +package sysx + +import ( + "syscall" + "unsafe" +) + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func CopyFileRange(fdin uintptr, offin *int64, fdout uintptr, offout *int64, len int, flags int) (n int, err error) { + r0, _, e1 := syscall.Syscall6(SYS_COPY_FILE_RANGE, uintptr(fdin), uintptr(unsafe.Pointer(offin)), uintptr(fdout), uintptr(unsafe.Pointer(offout)), uintptr(len), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/github.com/containerd/continuity/sysx/copy_linux_s390x.go b/vendor/github.com/containerd/continuity/sysx/copy_linux_s390x.go new file mode 100644 index 000000000..9941b01f0 --- /dev/null +++ b/vendor/github.com/containerd/continuity/sysx/copy_linux_s390x.go @@ -0,0 +1,20 @@ +// mksyscall.pl copy_linux.go +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + +package sysx + +import ( + "syscall" + "unsafe" +) + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func CopyFileRange(fdin uintptr, offin *int64, fdout uintptr, offout *int64, len int, flags int) (n int, err error) { + r0, _, e1 := syscall.Syscall6(SYS_COPY_FILE_RANGE, uintptr(fdin), uintptr(unsafe.Pointer(offin)), uintptr(fdout), uintptr(unsafe.Pointer(offout)), uintptr(len), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/github.com/containerd/continuity/sysx/nodata_solaris.go b/vendor/github.com/containerd/continuity/sysx/nodata_solaris.go new file mode 100644 index 000000000..53cc8e068 --- /dev/null +++ b/vendor/github.com/containerd/continuity/sysx/nodata_solaris.go @@ -0,0 +1,8 @@ +package sysx + +import ( + "syscall" +) + +// This should actually be a set that contains ENOENT and EPERM +const ENODATA = syscall.ENOENT diff --git a/vendor/github.com/containerd/continuity/sysx/sysnum_linux_ppc64le.go b/vendor/github.com/containerd/continuity/sysx/sysnum_linux_ppc64le.go new file mode 100644 index 000000000..5dea25a3c --- /dev/null +++ b/vendor/github.com/containerd/continuity/sysx/sysnum_linux_ppc64le.go @@ -0,0 +1,7 @@ +package sysx + +const ( + // SYS_COPYFILERANGE defined in Kernel 4.5+ + // Number defined in /usr/include/asm/unistd_64.h + SYS_COPY_FILE_RANGE = 379 +) diff --git a/vendor/github.com/containerd/continuity/sysx/sysnum_linux_s390x.go b/vendor/github.com/containerd/continuity/sysx/sysnum_linux_s390x.go new file mode 100644 index 000000000..8a6f2a7ec --- /dev/null +++ b/vendor/github.com/containerd/continuity/sysx/sysnum_linux_s390x.go @@ -0,0 +1,7 @@ +package sysx + +const ( + // SYS_COPYFILERANGE defined in Kernel 4.5+ + // Number defined in /usr/include/asm/unistd_64.h + SYS_COPY_FILE_RANGE = 375 +) diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_freebsd.go b/vendor/github.com/containerd/continuity/sysx/xattr_freebsd.go index 80dba49aa..e8017d317 100644 --- a/vendor/github.com/containerd/continuity/sysx/xattr_freebsd.go +++ b/vendor/github.com/containerd/continuity/sysx/xattr_freebsd.go @@ -9,45 +9,4 @@ import ( // it is also not widely used. It is not exposed at all by the // Go syscall package, so we need to implement directly eventually. -var unsupported error = errors.New("extended attributes unsupported on FreeBSD") - -// Listxattr calls syscall listxattr and reads all content -// and returns a string array -func Listxattr(path string) ([]string, error) { - return []string{}, nil -} - -// Removexattr calls syscall removexattr -func Removexattr(path string, attr string) (err error) { - return unsupported -} - -// Setxattr calls syscall setxattr -func Setxattr(path string, attr string, data []byte, flags int) (err error) { - return unsupported -} - -// Getxattr calls syscall getxattr -func Getxattr(path, attr string) ([]byte, error) { - return []byte{}, nil -} - -// LListxattr lists xattrs, not following symlinks -func LListxattr(path string) ([]string, error) { - return []string{}, nil -} - -// LRemovexattr removes an xattr, not following symlinks -func LRemovexattr(path string, attr string) (err error) { - return unsupported -} - -// LSetxattr sets an xattr, not following symlinks -func LSetxattr(path string, attr string, data []byte, flags int) (err error) { - return unsupported -} - -// LGetxattr gets an xattr, not following symlinks -func LGetxattr(path, attr string) ([]byte, error) { - return []byte{}, nil -} +var unsupported = errors.New("extended attributes unsupported on FreeBSD") diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_solaris.go b/vendor/github.com/containerd/continuity/sysx/xattr_solaris.go new file mode 100644 index 000000000..fc523fcbb --- /dev/null +++ b/vendor/github.com/containerd/continuity/sysx/xattr_solaris.go @@ -0,0 +1,12 @@ +package sysx + +import ( + "errors" +) + +// Initial stub version for Solaris. Solaris has a different +// syscall API from Darwin and Linux for extended attributes; +// it is also not widely used. It is not exposed at all by the +// Go syscall package, so we need to implement directly eventually. + +var unsupported = errors.New("extended attributes unsupported on Solaris") diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go b/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go new file mode 100644 index 000000000..a8dd9f245 --- /dev/null +++ b/vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go @@ -0,0 +1,44 @@ +// +build freebsd solaris + +package sysx + +// Listxattr calls syscall listxattr and reads all content +// and returns a string array +func Listxattr(path string) ([]string, error) { + return []string{}, nil +} + +// Removexattr calls syscall removexattr +func Removexattr(path string, attr string) (err error) { + return unsupported +} + +// Setxattr calls syscall setxattr +func Setxattr(path string, attr string, data []byte, flags int) (err error) { + return unsupported +} + +// Getxattr calls syscall getxattr +func Getxattr(path, attr string) ([]byte, error) { + return []byte{}, unsupported +} + +// LListxattr lists xattrs, not following symlinks +func LListxattr(path string) ([]string, error) { + return []string{}, nil +} + +// LRemovexattr removes an xattr, not following symlinks +func LRemovexattr(path string, attr string) (err error) { + return unsupported +} + +// LSetxattr sets an xattr, not following symlinks +func LSetxattr(path string, attr string, data []byte, flags int) (err error) { + return unsupported +} + +// LGetxattr gets an xattr, not following symlinks +func LGetxattr(path, attr string) ([]byte, error) { + return []byte{}, nil +}