mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
17708e72a7
Add a way to specify a custom graphdriver priority list during build. This can be done with something like go build -ldflags "-X github.com/docker/docker/daemon/graphdriver.priority=overlay2,devicemapper" As ldflags are already used by the engine build process, and it seems that only one (last) `-ldflags` argument is taken into account by go, an envoronment variable `DOCKER_LDFLAGS` is introduced in order to be able to append some text to `-ldflags`. With this in place, using the feature becomes make DOCKER_LDFLAGS="-X github.com/docker/docker/daemon/graphdriver.priority=overlay2,devicemapper" dynbinary The idea behind this is, the priority list might be different for different distros, so vendors are now able to change it without patching the source code. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
21 lines
420 B
Go
21 lines
420 B
Go
package graphdriver
|
|
|
|
import (
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
var (
|
|
// List of drivers that should be used in an order
|
|
priority = "zfs"
|
|
)
|
|
|
|
// Mounted checks if the given path is mounted as the fs type
|
|
func Mounted(fsType FsMagic, mountPath string) (bool, error) {
|
|
var buf unix.Statfs_t
|
|
if err := syscall.Statfs(mountPath, &buf); err != nil {
|
|
return false, err
|
|
}
|
|
return FsMagic(buf.Type) == fsType, nil
|
|
}
|