mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
24 lines
626 B
Go
24 lines
626 B
Go
package zfs
|
|
|
|
import (
|
|
"fmt"
|
|
"syscall"
|
|
|
|
log "github.com/Sirupsen/logrus"
|
|
"github.com/docker/docker/daemon/graphdriver"
|
|
)
|
|
|
|
func checkRootdirFs(rootdir string) error {
|
|
var buf syscall.Statfs_t
|
|
if err := syscall.Statfs(rootdir, &buf); err != nil {
|
|
return fmt.Errorf("Failed to access '%s': %s", rootdir, err)
|
|
}
|
|
|
|
// on FreeBSD buf.Fstypename contains ['z', 'f', 's', 0 ... ]
|
|
if (buf.Fstypename[0] != 122) || (buf.Fstypename[1] != 102) || (buf.Fstypename[2] != 115) || (buf.Fstypename[3] != 0) {
|
|
log.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir)
|
|
return graphdriver.ErrPrerequisites
|
|
}
|
|
|
|
return nil
|
|
}
|