mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-09 14:15:33 +02:00
* somehow now the only thing that doesnt work is devices.Device Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * this gets rid of all the compiler errors in the vendored code Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * fixed some things but a bunch of tests and maybe some compiler steps are still failing Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * all the things i figured out how to fix so far Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * guess i had to redo go mods after rebasing again Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * update docker constants to be SHOUTY CASE now Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * include DestPath in resolveEnv Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * fix one mistake in Docker lib upgrade and some typos/deprecations in the file Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * last changes (hopefully) to update to new docker libs Signed-off-by: Joe Kimmel <jkimmel@vmware.com> --------- Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
57 lines
1.1 KiB
Go
57 lines
1.1 KiB
Go
//go:build freebsd || openbsd || darwin
|
|
// +build freebsd openbsd darwin
|
|
|
|
package mountinfo
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
// parseMountTable returns information about mounted filesystems
|
|
func parseMountTable(filter FilterFunc) ([]*Info, error) {
|
|
count, err := unix.Getfsstat(nil, unix.MNT_WAIT)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
entries := make([]unix.Statfs_t, count)
|
|
_, err = unix.Getfsstat(entries, unix.MNT_WAIT)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
var out []*Info
|
|
for _, entry := range entries {
|
|
var skip, stop bool
|
|
mountinfo := getMountinfo(&entry)
|
|
|
|
if filter != nil {
|
|
// filter out entries we're not interested in
|
|
skip, stop = filter(mountinfo)
|
|
if skip {
|
|
continue
|
|
}
|
|
}
|
|
|
|
out = append(out, mountinfo)
|
|
if stop {
|
|
break
|
|
}
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
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)
|
|
if err == nil {
|
|
return mounted, nil
|
|
}
|
|
|
|
// Fallback to parsing mountinfo
|
|
return mountedByMountinfo(path)
|
|
}
|