Updates moby/sys mountinfo package to v0.6.0

Update to moby/sys/mountinfo package that contains MountedFast
function. The function uses OpenAt2 call for newer kernels
to determine if a mount-point is present or not.
This commit is contained in:
Manu Gupta
2022-03-19 16:09:21 -07:00
parent 475f7af1c1
commit f9abf7e7ac
11 changed files with 92 additions and 59 deletions

View File

@@ -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)