go.mod: github.com/moby/sys/mountinfo v0.5.0
full diff: https://github.com/moby/sys/compare/95edfa939201...mountinfo/v0.5.0 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
19d9d0d2a5
commit
97073c9437
2
go.mod
2
go.mod
@ -38,7 +38,7 @@ require (
|
||||
github.com/imdario/mergo v0.3.12
|
||||
github.com/klauspost/compress v1.11.13
|
||||
github.com/moby/locker v1.0.1
|
||||
github.com/moby/sys/mountinfo v0.4.2-0.20211022201527-95edfa939201
|
||||
github.com/moby/sys/mountinfo v0.5.0
|
||||
github.com/moby/sys/signal v0.6.0
|
||||
github.com/moby/sys/symlink v0.2.0
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
|
4
go.sum
4
go.sum
@ -427,8 +427,8 @@ github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQ
|
||||
github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=
|
||||
github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=
|
||||
github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
|
||||
github.com/moby/sys/mountinfo v0.4.2-0.20211022201527-95edfa939201 h1:3CCeKh7+WeRmAJdVR2aNruVqoRbHQ4UIq91gPnGdNrY=
|
||||
github.com/moby/sys/mountinfo v0.4.2-0.20211022201527-95edfa939201/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
|
||||
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=
|
||||
github.com/moby/sys/signal v0.6.0 h1:aDpY94H8VlhTGa9sNYUFCFsMZIUh5wm0B6XkIoJj/iY=
|
||||
github.com/moby/sys/signal v0.6.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg=
|
||||
github.com/moby/sys/symlink v0.2.0 h1:tk1rOM+Ljp0nFmfOIBtlV3rTDlWOwFRhjEeAhZB0nZc=
|
||||
|
@ -403,8 +403,8 @@ github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
|
||||
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
|
||||
github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=
|
||||
github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
|
||||
github.com/moby/sys/mountinfo v0.4.2-0.20211022201527-95edfa939201 h1:3CCeKh7+WeRmAJdVR2aNruVqoRbHQ4UIq91gPnGdNrY=
|
||||
github.com/moby/sys/mountinfo v0.4.2-0.20211022201527-95edfa939201/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
|
||||
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=
|
||||
github.com/moby/sys/signal v0.6.0 h1:aDpY94H8VlhTGa9sNYUFCFsMZIUh5wm0B6XkIoJj/iY=
|
||||
github.com/moby/sys/signal v0.6.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg=
|
||||
github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs=
|
||||
|
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 {
|
||||
|
14
vendor/github.com/moby/sys/mountinfo/mounted_unix.go
generated
vendored
14
vendor/github.com/moby/sys/mountinfo/mounted_unix.go
generated
vendored
@ -1,9 +1,9 @@
|
||||
//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) {
|
||||
|
5
vendor/github.com/moby/sys/mountinfo/mountinfo_bsd.go
generated
vendored
5
vendor/github.com/moby/sys/mountinfo/mountinfo_bsd.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build (freebsd && cgo) || (openbsd && cgo) || (darwin && cgo)
|
||||
// +build freebsd,cgo openbsd,cgo darwin,cgo
|
||||
|
||||
package mountinfo
|
||||
@ -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)
|
||||
|
1
vendor/github.com/moby/sys/mountinfo/mountinfo_unsupported.go
generated
vendored
1
vendor/github.com/moby/sys/mountinfo/mountinfo_unsupported.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//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
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -289,7 +289,7 @@ github.com/moby/locker
|
||||
# github.com/moby/spdystream v0.2.0
|
||||
github.com/moby/spdystream
|
||||
github.com/moby/spdystream/spdy
|
||||
# github.com/moby/sys/mountinfo v0.4.2-0.20211022201527-95edfa939201
|
||||
# github.com/moby/sys/mountinfo v0.5.0
|
||||
## explicit
|
||||
github.com/moby/sys/mountinfo
|
||||
# github.com/moby/sys/signal v0.6.0
|
||||
|
Loading…
Reference in New Issue
Block a user