code: func Wrap(w DoerAt, p []byte, off int64, wrapAt int64) (n int, err error) {
  	var m, fails int
  
  	off %= wrapAt
  
  	for len(p) > 0 {
  
  		if off+int64(len(p)) < wrapAt {
  			m, err = w.DoAt(p, off)
  		} else {
  			space := wrapAt - off
  			m, err = w.DoAt(p[:space], off)
  		}
  
  		if err != nil && err != io.EOF {
  			return n + m, err
  		}
  
  		switch m {
  		case 0:
  			fails++
  		default:
  			fails = 0
  		}
  
  		if fails > maxConsecutiveEmptyActions {
  			return n + m, io.ErrNoProgress
  		}
  
  		n += m
  		p = p[m:]
  		off += int64(m)
  		off %= wrapAt
  	}
  
  	return n, err
  }
docs: // Wrap causes an action on an array of bytes (like read/write) to be done from an offset off,
  // wrapping at offset wrapAt.