vendor: update github.com/containerd/continuity
Signed-off-by: Edward Pilatowicz <edward.pilatowicz@oracle.com>
This commit is contained in:
5
vendor/github.com/containerd/continuity/devices/devices.go
generated
vendored
Normal file
5
vendor/github.com/containerd/continuity/devices/devices.go
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
package devices
|
||||
|
||||
import "fmt"
|
||||
|
||||
var ErrNotSupported = fmt.Errorf("not supported")
|
||||
15
vendor/github.com/containerd/continuity/devices/devices_darwin.go
generated
vendored
Normal file
15
vendor/github.com/containerd/continuity/devices/devices_darwin.go
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package devices
|
||||
|
||||
// from /usr/include/sys/types.h
|
||||
|
||||
func getmajor(dev int32) uint64 {
|
||||
return (uint64(dev) >> 24) & 0xff
|
||||
}
|
||||
|
||||
func getminor(dev int32) uint64 {
|
||||
return uint64(dev) & 0xffffff
|
||||
}
|
||||
|
||||
func makedev(major int, minor int) int {
|
||||
return ((major << 24) | minor)
|
||||
}
|
||||
23
vendor/github.com/containerd/continuity/devices/devices_dummy.go
generated
vendored
Normal file
23
vendor/github.com/containerd/continuity/devices/devices_dummy.go
generated
vendored
Normal file
@@ -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.")
|
||||
}
|
||||
15
vendor/github.com/containerd/continuity/devices/devices_freebsd.go
generated
vendored
Normal file
15
vendor/github.com/containerd/continuity/devices/devices_freebsd.go
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package devices
|
||||
|
||||
// from /usr/include/sys/types.h
|
||||
|
||||
func getmajor(dev uint32) uint64 {
|
||||
return (uint64(dev) >> 24) & 0xff
|
||||
}
|
||||
|
||||
func getminor(dev uint32) uint64 {
|
||||
return uint64(dev) & 0xffffff
|
||||
}
|
||||
|
||||
func makedev(major int, minor int) int {
|
||||
return ((major << 24) | minor)
|
||||
}
|
||||
15
vendor/github.com/containerd/continuity/devices/devices_linux.go
generated
vendored
Normal file
15
vendor/github.com/containerd/continuity/devices/devices_linux.go
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package devices
|
||||
|
||||
// from /usr/include/linux/kdev_t.h
|
||||
|
||||
func getmajor(dev uint64) uint64 {
|
||||
return dev >> 8
|
||||
}
|
||||
|
||||
func getminor(dev uint64) uint64 {
|
||||
return dev & 0xff
|
||||
}
|
||||
|
||||
func makedev(major int, minor int) int {
|
||||
return ((major << 8) | minor)
|
||||
}
|
||||
18
vendor/github.com/containerd/continuity/devices/devices_solaris.go
generated
vendored
Normal file
18
vendor/github.com/containerd/continuity/devices/devices_solaris.go
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// +build cgo
|
||||
|
||||
package devices
|
||||
|
||||
//#include <sys/mkdev.h>
|
||||
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)))
|
||||
}
|
||||
55
vendor/github.com/containerd/continuity/devices/devices_unix.go
generated
vendored
Normal file
55
vendor/github.com/containerd/continuity/devices/devices_unix.go
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
// +build linux darwin freebsd solaris
|
||||
|
||||
package devices
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
return getmajor(sys.Rdev), getminor(sys.Rdev), nil
|
||||
}
|
||||
|
||||
// mknod provides a shortcut for syscall.Mknod
|
||||
func Mknod(p string, mode os.FileMode, maj, min int) error {
|
||||
var (
|
||||
m = syscallMode(mode.Perm())
|
||||
dev int
|
||||
)
|
||||
|
||||
if mode&os.ModeDevice != 0 {
|
||||
dev = makedev(maj, min)
|
||||
|
||||
if mode&os.ModeCharDevice != 0 {
|
||||
m |= syscall.S_IFCHR
|
||||
} else {
|
||||
m |= syscall.S_IFBLK
|
||||
}
|
||||
} else if mode&os.ModeNamedPipe != 0 {
|
||||
m |= syscall.S_IFIFO
|
||||
}
|
||||
|
||||
return syscall.Mknod(p, m, dev)
|
||||
}
|
||||
|
||||
// syscallMode returns the syscall-specific mode bits from Go's portable mode bits.
|
||||
func syscallMode(i os.FileMode) (o uint32) {
|
||||
o |= uint32(i.Perm())
|
||||
if i&os.ModeSetuid != 0 {
|
||||
o |= syscall.S_ISUID
|
||||
}
|
||||
if i&os.ModeSetgid != 0 {
|
||||
o |= syscall.S_ISGID
|
||||
}
|
||||
if i&os.ModeSticky != 0 {
|
||||
o |= syscall.S_ISVTX
|
||||
}
|
||||
return
|
||||
}
|
||||
11
vendor/github.com/containerd/continuity/devices/devices_windows.go
generated
vendored
Normal file
11
vendor/github.com/containerd/continuity/devices/devices_windows.go
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
package devices
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func DeviceInfo(fi os.FileInfo) (uint64, uint64, error) {
|
||||
return 0, 0, errors.Wrap(ErrNotSupported, "cannot get device info on windows")
|
||||
}
|
||||
Reference in New Issue
Block a user