github.com/kinvolk/docker@v1.13.1/daemon/graphdriver/zfs/zfs_freebsd.go (about) 1 package zfs 2 3 import ( 4 "fmt" 5 "strings" 6 "syscall" 7 8 "github.com/Sirupsen/logrus" 9 "github.com/docker/docker/daemon/graphdriver" 10 ) 11 12 func checkRootdirFs(rootdir string) error { 13 var buf syscall.Statfs_t 14 if err := syscall.Statfs(rootdir, &buf); err != nil { 15 return fmt.Errorf("Failed to access '%s': %s", rootdir, err) 16 } 17 18 // on FreeBSD buf.Fstypename contains ['z', 'f', 's', 0 ... ] 19 if (buf.Fstypename[0] != 122) || (buf.Fstypename[1] != 102) || (buf.Fstypename[2] != 115) || (buf.Fstypename[3] != 0) { 20 logrus.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir) 21 return graphdriver.ErrPrerequisites 22 } 23 24 return nil 25 } 26 27 func getMountpoint(id string) string { 28 maxlen := 12 29 30 // we need to preserve filesystem suffix 31 suffix := strings.SplitN(id, "-", 2) 32 33 if len(suffix) > 1 { 34 return id[:maxlen] + "-" + suffix[1] 35 } 36 37 return id[:maxlen] 38 }