mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-21 03:07:46 +08:00

commit c41b006be1078aa358721b9a92e17eab9a51a958 updated the version of
docker/docker in go.mod, but possibly overlooked that there was still a
replace rule present. As a result the version was not actually updated.
This patch removes the replace rule, updating docker/docker to 9f28837c1d93
full diff: 4634ce647c...9f28837c1d
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
package mountinfo
|
|
|
|
/*
|
|
#include <sys/param.h>
|
|
#include <sys/ucred.h>
|
|
#include <sys/mount.h>
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
"unsafe"
|
|
)
|
|
|
|
// parseMountTable returns information about mounted filesystems
|
|
func parseMountTable(filter FilterFunc) ([]*Info, error) {
|
|
var rawEntries *C.struct_statfs
|
|
|
|
count := int(C.getmntinfo(&rawEntries, C.MNT_WAIT))
|
|
if count == 0 {
|
|
return nil, fmt.Errorf("Failed to call getmntinfo")
|
|
}
|
|
|
|
var entries []C.struct_statfs
|
|
header := (*reflect.SliceHeader)(unsafe.Pointer(&entries))
|
|
header.Cap = count
|
|
header.Len = count
|
|
header.Data = uintptr(unsafe.Pointer(rawEntries))
|
|
|
|
var out []*Info
|
|
for _, entry := range entries {
|
|
var mountinfo Info
|
|
var skip, stop bool
|
|
mountinfo.Mountpoint = C.GoString(&entry.f_mntonname[0])
|
|
mountinfo.Fstype = C.GoString(&entry.f_fstypename[0])
|
|
mountinfo.Source = C.GoString(&entry.f_mntfromname[0])
|
|
|
|
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
|
|
}
|