mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to 539be170
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
1
vendor/github.com/moby/sys/mount/flags_bsd.go
generated
vendored
1
vendor/github.com/moby/sys/mount/flags_bsd.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build freebsd || openbsd
|
||||
// +build freebsd openbsd
|
||||
|
||||
package mount
|
||||
|
3
vendor/github.com/moby/sys/mount/flags_unix.go
generated
vendored
3
vendor/github.com/moby/sys/mount/flags_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !darwin && !windows
|
||||
// +build !darwin,!windows
|
||||
|
||||
package mount
|
||||
@ -101,7 +102,7 @@ func MergeTmpfsOptions(options []string) ([]string, error) {
|
||||
}
|
||||
opt := strings.SplitN(option, "=", 2)
|
||||
if len(opt) != 2 || !validFlags[opt[0]] {
|
||||
return nil, fmt.Errorf("Invalid tmpfs option %q", opt)
|
||||
return nil, fmt.Errorf("invalid tmpfs option %q", opt)
|
||||
}
|
||||
if !dataCollisions[opt[0]] {
|
||||
// We prepend the option and add to collision map
|
||||
|
6
vendor/github.com/moby/sys/mount/go.mod
generated
vendored
6
vendor/github.com/moby/sys/mount/go.mod
generated
vendored
@ -1,8 +1,8 @@
|
||||
module github.com/moby/sys/mount
|
||||
|
||||
go 1.14
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/moby/sys/mountinfo v0.4.0
|
||||
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860
|
||||
github.com/moby/sys/mountinfo v0.5.0
|
||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359
|
||||
)
|
||||
|
9
vendor/github.com/moby/sys/mount/go.sum
generated
vendored
9
vendor/github.com/moby/sys/mount/go.sum
generated
vendored
@ -1,5 +1,4 @@
|
||||
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=
|
||||
github.com/moby/sys/mountinfo v0.5.0 h1:2Ks8/r6lopsxWi9m58nlwjaeSzUX9iiL1vj5qB/9ObI=
|
||||
github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU=
|
||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik=
|
||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
1
vendor/github.com/moby/sys/mount/mount_errors.go
generated
vendored
1
vendor/github.com/moby/sys/mount/mount_errors.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package mount
|
||||
|
3
vendor/github.com/moby/sys/mount/mount_unix.go
generated
vendored
3
vendor/github.com/moby/sys/mount/mount_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !darwin && !windows
|
||||
// +build !darwin,!windows
|
||||
|
||||
package mount
|
||||
@ -22,7 +23,7 @@ func Mount(device, target, mType, options string) error {
|
||||
// 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 {
|
||||
if err == nil || err == unix.EINVAL { //nolint:errorlint // unix errors are bare
|
||||
// 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.
|
||||
|
@ -1,4 +1,5 @@
|
||||
// +build freebsd,cgo openbsd,cgo
|
||||
//go:build freebsd && cgo
|
||||
// +build freebsd,cgo
|
||||
|
||||
package mount
|
||||
|
1
vendor/github.com/moby/sys/mount/mounter_linux.go
generated
vendored
1
vendor/github.com/moby/sys/mount/mounter_linux.go
generated
vendored
@ -65,7 +65,6 @@ func mount(device, target, mType string, flags uintptr, data string) error {
|
||||
flags: oflags | unix.MS_REMOUNT,
|
||||
err: err,
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
78
vendor/github.com/moby/sys/mount/mounter_openbsd.go
generated
vendored
Normal file
78
vendor/github.com/moby/sys/mount/mounter_openbsd.go
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
//go:build openbsd && cgo
|
||||
// +build openbsd,cgo
|
||||
|
||||
/*
|
||||
Due to how OpenBSD mount(2) works, filesystem types need to be
|
||||
supported explicitly since it uses separate structs to pass
|
||||
filesystem-specific arguments.
|
||||
|
||||
For now only UFS/FFS is supported as it's the default fs
|
||||
on OpenBSD systems.
|
||||
|
||||
See: https://man.openbsd.org/mount.2
|
||||
*/
|
||||
|
||||
package mount
|
||||
|
||||
/*
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func createExportInfo(readOnly bool) C.struct_export_args {
|
||||
exportFlags := C.int(0)
|
||||
if readOnly {
|
||||
exportFlags = C.MNT_EXRDONLY
|
||||
}
|
||||
out := C.struct_export_args{
|
||||
ex_root: 0,
|
||||
ex_flags: exportFlags,
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func createUfsArgs(device string, readOnly bool) unsafe.Pointer {
|
||||
out := &C.struct_ufs_args{
|
||||
fspec: C.CString(device),
|
||||
export_info: createExportInfo(readOnly),
|
||||
}
|
||||
return unsafe.Pointer(out)
|
||||
}
|
||||
|
||||
func mount(device, target, mType string, flag uintptr, data string) error {
|
||||
readOnly := flag&RDONLY != 0
|
||||
|
||||
var fsArgs unsafe.Pointer
|
||||
|
||||
switch mType {
|
||||
case "ffs":
|
||||
fsArgs = createUfsArgs(device, readOnly)
|
||||
default:
|
||||
return &mountError{
|
||||
op: "mount",
|
||||
source: device,
|
||||
target: target,
|
||||
flags: flag,
|
||||
err: fmt.Errorf("unsupported file system type: %s", mType),
|
||||
}
|
||||
}
|
||||
|
||||
if errno := C.mount(C.CString(mType), C.CString(target), C.int(flag), fsArgs); errno != 0 {
|
||||
return &mountError{
|
||||
op: "mount",
|
||||
source: device,
|
||||
target: target,
|
||||
flags: flag,
|
||||
err: syscall.Errno(errno),
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
1
vendor/github.com/moby/sys/mount/mounter_unsupported.go
generated
vendored
1
vendor/github.com/moby/sys/mount/mounter_unsupported.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build (!linux && !freebsd && !openbsd && !windows) || (freebsd && !cgo) || (openbsd && !cgo)
|
||||
// +build !linux,!freebsd,!openbsd,!windows freebsd,!cgo openbsd,!cgo
|
||||
|
||||
package mount
|
||||
|
4
vendor/github.com/moby/sys/mountinfo/go.mod
generated
vendored
4
vendor/github.com/moby/sys/mountinfo/go.mod
generated
vendored
@ -1,5 +1,5 @@
|
||||
module github.com/moby/sys/mountinfo
|
||||
|
||||
go 1.14
|
||||
go 1.16
|
||||
|
||||
require golang.org/x/sys v0.0.0-20200909081042-eff7692f9009
|
||||
require golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359
|
||||
|
4
vendor/github.com/moby/sys/mountinfo/go.sum
generated
vendored
4
vendor/github.com/moby/sys/mountinfo/go.sum
generated
vendored
@ -1,2 +1,2 @@
|
||||
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009 h1:W0lCpv29Hv0UaM1LXb9QlBHLNP8UFfcKjblhVCWftOM=
|
||||
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik=
|
||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
11
vendor/github.com/moby/sys/mountinfo/mounted_linux.go
generated
vendored
11
vendor/github.com/moby/sys/mountinfo/mounted_linux.go
generated
vendored
@ -16,9 +16,6 @@ func mountedByOpenat2(path string) (bool, error) {
|
||||
Flags: unix.O_PATH | unix.O_CLOEXEC,
|
||||
})
|
||||
if err != nil {
|
||||
if err == unix.ENOENT { // not a mount
|
||||
return false, nil
|
||||
}
|
||||
return false, &os.PathError{Op: "openat2", Path: dir, Err: err}
|
||||
}
|
||||
fd, err := unix.Openat2(dirfd, last, &unix.OpenHow{
|
||||
@ -26,20 +23,22 @@ func mountedByOpenat2(path string) (bool, error) {
|
||||
Resolve: unix.RESOLVE_NO_XDEV,
|
||||
})
|
||||
_ = unix.Close(dirfd)
|
||||
switch err {
|
||||
switch err { //nolint:errorlint // unix errors are bare
|
||||
case nil: // definitely not a mount
|
||||
_ = unix.Close(fd)
|
||||
return false, nil
|
||||
case unix.EXDEV: // definitely a mount
|
||||
return true, nil
|
||||
case unix.ENOENT: // not a mount
|
||||
return false, nil
|
||||
}
|
||||
// not sure
|
||||
return false, &os.PathError{Op: "openat2", Path: path, Err: err}
|
||||
}
|
||||
|
||||
func mounted(path string) (bool, error) {
|
||||
path, err := normalizePath(path)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
// Try a fast path, using openat2() with RESOLVE_NO_XDEV.
|
||||
mounted, err := mountedByOpenat2(path)
|
||||
if err == nil {
|
||||
|
16
vendor/github.com/moby/sys/mountinfo/mounted_unix.go
generated
vendored
16
vendor/github.com/moby/sys/mountinfo/mounted_unix.go
generated
vendored
@ -1,9 +1,9 @@
|
||||
// +build linux freebsd,cgo openbsd,cgo
|
||||
//go:build linux || (freebsd && cgo) || (openbsd && cgo) || (darwin && cgo)
|
||||
// +build linux freebsd,cgo openbsd,cgo darwin,cgo
|
||||
|
||||
package mountinfo
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -15,10 +15,6 @@ func mountedByStat(path string) (bool, error) {
|
||||
var st unix.Stat_t
|
||||
|
||||
if err := unix.Lstat(path, &st); err != nil {
|
||||
if err == unix.ENOENT {
|
||||
// Treat ENOENT as "not mounted".
|
||||
return false, nil
|
||||
}
|
||||
return false, &os.PathError{Op: "stat", Path: path, Err: err}
|
||||
}
|
||||
dev := st.Dev
|
||||
@ -49,14 +45,6 @@ func normalizePath(path string) (realPath string, err error) {
|
||||
}
|
||||
|
||||
func mountedByMountinfo(path string) (bool, error) {
|
||||
path, err := normalizePath(path)
|
||||
if err != nil {
|
||||
if errors.Is(err, unix.ENOENT) {
|
||||
// treat ENOENT as "not mounted"
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
entries, err := GetMounts(SingleEntryFilter(path))
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
9
vendor/github.com/moby/sys/mountinfo/mountinfo.go
generated
vendored
9
vendor/github.com/moby/sys/mountinfo/mountinfo.go
generated
vendored
@ -10,11 +10,12 @@ func GetMounts(f FilterFunc) ([]*Info, error) {
|
||||
return parseMountTable(f)
|
||||
}
|
||||
|
||||
// Mounted determines if a specified path is a mount point.
|
||||
// Mounted determines if a specified path is a mount point. In case of any
|
||||
// error, false (and an error) is returned.
|
||||
//
|
||||
// The argument must be an absolute path, with all symlinks resolved, and clean.
|
||||
// One way to ensure it is to process the path using filepath.Abs followed by
|
||||
// filepath.EvalSymlinks before calling this function.
|
||||
// The non-existent path returns an error. If a caller is not interested
|
||||
// in this particular error, it should handle it separately using e.g.
|
||||
// errors.Is(err, os.ErrNotExist).
|
||||
func Mounted(path string) (bool, error) {
|
||||
// root is always mounted
|
||||
if path == string(os.PathSeparator) {
|
||||
|
9
vendor/github.com/moby/sys/mountinfo/mountinfo_bsd.go
generated
vendored
9
vendor/github.com/moby/sys/mountinfo/mountinfo_bsd.go
generated
vendored
@ -1,4 +1,5 @@
|
||||
// +build freebsd,cgo openbsd,cgo
|
||||
//go:build (freebsd && cgo) || (openbsd && cgo) || (darwin && cgo)
|
||||
// +build freebsd,cgo openbsd,cgo darwin,cgo
|
||||
|
||||
package mountinfo
|
||||
|
||||
@ -21,7 +22,7 @@ func parseMountTable(filter FilterFunc) ([]*Info, error) {
|
||||
|
||||
count := int(C.getmntinfo(&rawEntries, C.MNT_WAIT))
|
||||
if count == 0 {
|
||||
return nil, fmt.Errorf("Failed to call getmntinfo")
|
||||
return nil, fmt.Errorf("failed to call getmntinfo")
|
||||
}
|
||||
|
||||
var entries []C.struct_statfs
|
||||
@ -55,6 +56,10 @@ func parseMountTable(filter FilterFunc) ([]*Info, error) {
|
||||
}
|
||||
|
||||
func mounted(path string) (bool, error) {
|
||||
path, err := normalizePath(path)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
// Fast path: compare st.st_dev fields.
|
||||
// This should always work for FreeBSD and OpenBSD.
|
||||
mounted, err := mountedByStat(path)
|
||||
|
27
vendor/github.com/moby/sys/mountinfo/mountinfo_linux.go
generated
vendored
27
vendor/github.com/moby/sys/mountinfo/mountinfo_linux.go
generated
vendored
@ -52,7 +52,7 @@ func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) {
|
||||
numFields := len(fields)
|
||||
if numFields < 10 {
|
||||
// should be at least 10 fields
|
||||
return nil, fmt.Errorf("Parsing '%s' failed: not enough fields (%d)", text, numFields)
|
||||
return nil, fmt.Errorf("parsing '%s' failed: not enough fields (%d)", text, numFields)
|
||||
}
|
||||
|
||||
// separator field
|
||||
@ -67,7 +67,7 @@ func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) {
|
||||
for fields[sepIdx] != "-" {
|
||||
sepIdx--
|
||||
if sepIdx == 5 {
|
||||
return nil, fmt.Errorf("Parsing '%s' failed: missing - separator", text)
|
||||
return nil, fmt.Errorf("parsing '%s' failed: missing - separator", text)
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,46 +75,39 @@ func GetMountsFromReader(r io.Reader, filter FilterFunc) ([]*Info, error) {
|
||||
|
||||
p.Mountpoint, err = unescape(fields[4])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Parsing '%s' failed: mount point: %w", fields[4], err)
|
||||
return nil, fmt.Errorf("parsing '%s' failed: mount point: %w", fields[4], err)
|
||||
}
|
||||
p.FSType, err = unescape(fields[sepIdx+1])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Parsing '%s' failed: fstype: %w", fields[sepIdx+1], err)
|
||||
return nil, fmt.Errorf("parsing '%s' failed: fstype: %w", fields[sepIdx+1], err)
|
||||
}
|
||||
p.Source, err = unescape(fields[sepIdx+2])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Parsing '%s' failed: source: %w", fields[sepIdx+2], err)
|
||||
return nil, fmt.Errorf("parsing '%s' failed: source: %w", fields[sepIdx+2], err)
|
||||
}
|
||||
p.VFSOptions = fields[sepIdx+3]
|
||||
|
||||
// ignore any numbers parsing errors, as there should not be any
|
||||
p.ID, _ = strconv.Atoi(fields[0])
|
||||
p.Parent, _ = strconv.Atoi(fields[1])
|
||||
mm := strings.Split(fields[2], ":")
|
||||
mm := strings.SplitN(fields[2], ":", 3)
|
||||
if len(mm) != 2 {
|
||||
return nil, fmt.Errorf("Parsing '%s' failed: unexpected minor:major pair %s", text, mm)
|
||||
return nil, fmt.Errorf("parsing '%s' failed: unexpected major:minor pair %s", text, mm)
|
||||
}
|
||||
p.Major, _ = strconv.Atoi(mm[0])
|
||||
p.Minor, _ = strconv.Atoi(mm[1])
|
||||
|
||||
p.Root, err = unescape(fields[3])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Parsing '%s' failed: root: %w", fields[3], err)
|
||||
return nil, fmt.Errorf("parsing '%s' failed: root: %w", fields[3], err)
|
||||
}
|
||||
|
||||
p.Options = fields[5]
|
||||
|
||||
// zero or more optional fields
|
||||
switch {
|
||||
case sepIdx == 6:
|
||||
// zero, do nothing
|
||||
case sepIdx == 7:
|
||||
p.Optional = fields[6]
|
||||
default:
|
||||
p.Optional = strings.Join(fields[6:sepIdx-1], " ")
|
||||
}
|
||||
p.Optional = strings.Join(fields[6:sepIdx], " ")
|
||||
|
||||
// Run the filter after parsing all of the fields.
|
||||
// Run the filter after parsing all fields.
|
||||
var skip, stop bool
|
||||
if filter != nil {
|
||||
skip, stop = filter(p)
|
||||
|
3
vendor/github.com/moby/sys/mountinfo/mountinfo_unsupported.go
generated
vendored
3
vendor/github.com/moby/sys/mountinfo/mountinfo_unsupported.go
generated
vendored
@ -1,4 +1,5 @@
|
||||
// +build !windows,!linux,!freebsd,!openbsd freebsd,!cgo openbsd,!cgo
|
||||
//go:build (!windows && !linux && !freebsd && !openbsd && !darwin) || (freebsd && !cgo) || (openbsd && !cgo) || (darwin && !cgo)
|
||||
// +build !windows,!linux,!freebsd,!openbsd,!darwin freebsd,!cgo openbsd,!cgo darwin,!cgo
|
||||
|
||||
package mountinfo
|
||||
|
||||
|
Reference in New Issue
Block a user