Update gomod and vendor

This commit is contained in:
Ettore Di Giacinto
2021-01-19 18:29:09 +01:00
parent dbd37afced
commit 7b25a54653
930 changed files with 183699 additions and 4609 deletions

4
vendor/github.com/moby/sys/mount/doc.go generated vendored Normal file
View File

@@ -0,0 +1,4 @@
// Package mount provides a set of functions to mount and unmount mounts.
//
// Currently it supports Linux. For historical reasons, there is also some support for FreeBSD.
package mount

View File

@@ -1,28 +1,25 @@
// +build freebsd,cgo
// +build freebsd openbsd
package mount
/*
#include <sys/mount.h>
*/
import "C"
import "golang.org/x/sys/unix"
const (
// RDONLY will mount the filesystem as read-only.
RDONLY = C.MNT_RDONLY
RDONLY = unix.MNT_RDONLY
// NOSUID will not allow set-user-identifier or set-group-identifier bits to
// take effect.
NOSUID = C.MNT_NOSUID
NOSUID = unix.MNT_NOSUID
// NOEXEC will not allow execution of any binaries on the mounted file system.
NOEXEC = C.MNT_NOEXEC
NOEXEC = unix.MNT_NOEXEC
// SYNCHRONOUS will allow any I/O to the file system to be done synchronously.
SYNCHRONOUS = C.MNT_SYNCHRONOUS
SYNCHRONOUS = unix.MNT_SYNCHRONOUS
// NOATIME will not update the file access time when reading from a file.
NOATIME = C.MNT_NOATIME
NOATIME = unix.MNT_NOATIME
)
// These flags are unsupported.

View File

@@ -1,3 +1,5 @@
// +build !darwin,!windows
package mount
import (

View File

@@ -1,30 +0,0 @@
// +build !linux,!freebsd freebsd,!cgo
package mount
// These flags are unsupported.
const (
BIND = 0
DIRSYNC = 0
MANDLOCK = 0
NOATIME = 0
NODEV = 0
NODIRATIME = 0
NOEXEC = 0
NOSUID = 0
UNBINDABLE = 0
RUNBINDABLE = 0
PRIVATE = 0
RPRIVATE = 0
SHARED = 0
RSHARED = 0
SLAVE = 0
RSLAVE = 0
RBIND = 0
RELATIME = 0
REMOUNT = 0
STRICTATIME = 0
SYNCHRONOUS = 0
RDONLY = 0
mntDetach = 0
)

View File

@@ -3,6 +3,6 @@ module github.com/moby/sys/mount
go 1.14
require (
github.com/moby/sys/mountinfo v0.1.0
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae
github.com/moby/sys/mountinfo v0.4.0
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860
)

View File

@@ -1,4 +1,5 @@
github.com/moby/sys/mountinfo v0.1.0 h1:r8vMRbMAFEAfiNptYVokP+nfxPJzvRuia5e2vzXtENo=
github.com/moby/sys/mountinfo v0.1.0/go.mod h1:w2t2Avltqx8vE7gX5l+QiBKxODu2TX0+Syr3h52Tw4o=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
github.com/moby/sys/mountinfo v0.4.0 h1:1KInV3Huv18akCu58V7lzNlt+jFmqlu1EaErnEHE/VM=
github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860 h1:YEu4SMq7D0cmT7CBbXfcH0NZeuChAXwsHe/9XueUO6o=
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

View File

@@ -1,56 +0,0 @@
// +build go1.13
package mount
import (
"fmt"
"sort"
"github.com/moby/sys/mountinfo"
)
// Mount will mount filesystem according to the specified configuration.
// Options must be specified like the mount or fstab unix commands:
// "opt1=val1,opt2=val2". See flags.go for supported option flags.
func Mount(device, target, mType, options string) error {
flag, data := parseOptions(options)
return mount(device, target, mType, uintptr(flag), data)
}
// Unmount lazily unmounts a filesystem on supported platforms, otherwise
// does a normal unmount.
func Unmount(target string) error {
return unmount(target, mntDetach)
}
// RecursiveUnmount unmounts the target and all mounts underneath, starting with
// the deepsest mount first.
func RecursiveUnmount(target string) error {
mounts, err := mountinfo.GetMounts(mountinfo.PrefixFilter(target))
if err != nil {
return err
}
// Make the deepest mount be first
sort.Slice(mounts, func(i, j int) bool {
return len(mounts[i].Mountpoint) > len(mounts[j].Mountpoint)
})
var suberr error
for i, m := range mounts {
err = unmount(m.Mountpoint, mntDetach)
if err != nil {
if i == len(mounts)-1 { // last mount
return fmt.Errorf("%w (possible cause: %s)", err, suberr)
}
// This is a submount, we can ignore the error for now,
// the final unmount will fail if this is a real problem.
// With that in mind, the _first_ failed unmount error
// might be the real error cause, so let's keep it.
if suberr == nil {
suberr = err
}
}
}
return nil
}

87
vendor/github.com/moby/sys/mount/mount_unix.go generated vendored Normal file
View File

@@ -0,0 +1,87 @@
// +build !darwin,!windows
package mount
import (
"fmt"
"sort"
"github.com/moby/sys/mountinfo"
"golang.org/x/sys/unix"
)
// Mount will mount filesystem according to the specified configuration.
// Options must be specified like the mount or fstab unix commands:
// "opt1=val1,opt2=val2". See flags.go for supported option flags.
func Mount(device, target, mType, options string) error {
flag, data := parseOptions(options)
return mount(device, target, mType, uintptr(flag), data)
}
// Unmount lazily unmounts a filesystem on supported platforms, otherwise does
// a normal unmount. If target is not a mount point, no error is returned.
func Unmount(target string) error {
err := unix.Unmount(target, mntDetach)
if err == nil || err == unix.EINVAL {
// Ignore "not mounted" error here. Note the same error
// can be returned if flags are invalid, so this code
// assumes that the flags value is always correct.
return nil
}
return &mountError{
op: "umount",
target: target,
flags: uintptr(mntDetach),
err: err,
}
}
// RecursiveUnmount unmounts the target and all mounts underneath, starting
// with the deepest mount first. The argument does not have to be a mount
// point itself.
func RecursiveUnmount(target string) error {
// Fast path, works if target is a mount point that can be unmounted.
// On Linux, mntDetach flag ensures a recursive unmount. For other
// platforms, if there are submounts, we'll get EBUSY (and fall back
// to the slow path). NOTE we do not ignore EINVAL here as target might
// not be a mount point itself (but there can be mounts underneath).
if err := unix.Unmount(target, mntDetach); err == nil {
return nil
}
// Slow path: get all submounts, sort, unmount one by one.
mounts, err := mountinfo.GetMounts(mountinfo.PrefixFilter(target))
if err != nil {
return err
}
// Make the deepest mount be first
sort.Slice(mounts, func(i, j int) bool {
return len(mounts[i].Mountpoint) > len(mounts[j].Mountpoint)
})
var (
suberr error
lastMount = len(mounts) - 1
)
for i, m := range mounts {
err = Unmount(m.Mountpoint)
if err != nil {
if i == lastMount {
if suberr != nil {
return fmt.Errorf("%w (possible cause: %s)", err, suberr)
}
return err
}
// This is a submount, we can ignore the error for now,
// the final unmount will fail if this is a real problem.
// With that in mind, the _first_ failed unmount error
// might be the real error cause, so let's keep it.
if suberr == nil {
suberr = err
}
}
}
return nil
}

View File

@@ -1,3 +1,5 @@
// +build freebsd,cgo openbsd,cgo
package mount
/*

View File

@@ -1,7 +1,7 @@
// +build !linux,!freebsd freebsd,!cgo
// +build !linux,!freebsd,!openbsd,!windows freebsd,!cgo openbsd,!cgo
package mount
func mount(device, target, mType string, flag uintptr, data string) error {
panic("Not implemented")
panic("cgo required on freebsd and openbsd")
}

View File

@@ -1,22 +0,0 @@
// +build !windows
package mount
import "golang.org/x/sys/unix"
func unmount(target string, flags int) error {
err := unix.Unmount(target, flags)
if err == nil || err == unix.EINVAL {
// Ignore "not mounted" error here. Note the same error
// can be returned if flags are invalid, so this code
// assumes that the flags value is always correct.
return nil
}
return &mountError{
op: "umount",
target: target,
flags: uintptr(flags),
err: err,
}
}

View File

@@ -1,7 +0,0 @@
// +build windows
package mount
func unmount(target string, flag int) error {
panic("Not implemented")
}