blob: 5d86dc3a9705df17ce9fbe792df3e50d71f98f76 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package zfs // import "github.com/docker/docker/daemon/graphdriver/zfs"
import (
"strings"
"github.com/docker/docker/daemon/graphdriver"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)
func checkRootdirFs(rootdir string) error {
var buf unix.Statfs_t
if err := unix.Statfs(rootdir, &buf); err != nil {
return 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) {
logrus.WithField("storage-driver", "zfs").Debugf("no zfs dataset found for rootdir '%s'", rootdir)
return graphdriver.ErrPrerequisites
}
return nil
}
const maxlen = 12
func getMountpoint(id string) string {
id, suffix, _ := strings.Cut(id, "-")
id = id[:maxlen]
if suffix != "" {
// preserve filesystem suffix.
id += "-" + suffix
}
return id
}
|