// Mounted checks if the given path is mounted as the fs type //Solaris supports only ZFS for now func Mounted(fsType FsMagic, mountPath string) (bool, error) { cs := C.CString(filepath.Dir(mountPath)) buf := C.getstatfs(cs) // on Solaris buf.f_basetype contains ['z', 'f', 's', 0 ... ] if (buf.f_basetype[0] != 122) || (buf.f_basetype[1] != 102) || (buf.f_basetype[2] != 115) || (buf.f_basetype[3] != 0) { logrus.Debugf("[zfs] no zfs dataset found for rootdir '%s'", mountPath) C.free(unsafe.Pointer(buf)) return false, ErrPrerequisites } C.free(unsafe.Pointer(buf)) C.free(unsafe.Pointer(cs)) return true, nil }
func checkRootdirFs(rootdir string) error { cs := C.CString(filepath.Dir(rootdir)) buf := C.getstatfs(cs) // on Solaris buf.f_basetype contains ['z', 'f', 's', 0 ... ] if (buf.f_basetype[0] != 122) || (buf.f_basetype[1] != 102) || (buf.f_basetype[2] != 115) || (buf.f_basetype[3] != 0) { logrus.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir) C.free(unsafe.Pointer(buf)) return graphdriver.ErrPrerequisites } C.free(unsafe.Pointer(buf)) C.free(unsafe.Pointer(cs)) return nil }