code: func PathSupportsOverlay(path string) error {
  	if err := SupportsOverlay(); err != nil {
  		// don't wrap since SupportsOverlay already returns ErrOverlayUnsupported
  		return err
  	}
  
  	var data syscall.Statfs_t
  	if err := syscall.Statfs(path, &data); err != nil {
  		return errwrap.Wrap(fmt.Errorf("cannot statfs %q", path), err)
  	}
  
  	switch data.Type {
  	case FsMagicAUFS:
  		return ErrOverlayUnsupported("unsupported filesystem: aufs")
  	case FsMagicZFS:
  		return ErrOverlayUnsupported("unsupported filesystem: zfs")
  	}
  
  	dir, err := os.OpenFile(path, syscall.O_RDONLY|syscall.O_DIRECTORY, 0755)
  	if err != nil {
  		return errwrap.Wrap(fmt.Errorf("cannot open %q", path), err)
  	}
  	defer dir.Close()
  
  	buf := make([]byte, 4096)
  	// ReadDirent forwards to the raw syscall getdents(3),
  	// passing the buffer size.
  	n, err := syscall.ReadDirent(int(dir.Fd()), buf)
  	if err != nil {
  		return errwrap.Wrap(fmt.Errorf("cannot read directory %q", path), err)
  	}
  
  	offset := 0
  	for offset < n {
  		// offset overflow cannot happen, because Reclen
  		// is being maintained by getdents(3), considering the buffer size.
  		dirent := (*syscall.Dirent)(unsafe.Pointer(&buf[offset]))
  		offset += int(dirent.Reclen)
  
  		if dirent.Ino == 0 { // File absent in directory.
  			continue
  		}
  
  		if dirent.Type == syscall.DT_UNKNOWN {
  			return ErrOverlayUnsupported("unsupported filesystem: missing d_type support")
  		}
  	}
  
  	return nil
  }
docs: // PathSupportsOverlay checks whether the given path is compatible with OverlayFS.
  // This method also calls SupportsOverlay().
  //
  // It returns an instance of ErrOverlayUnsupported if OverlayFS is not supported
  // or any other error if determining overlay support failed.