MCPcopy Index your code
hub / github.com/RsyncProject/rsync / skip_matched

Function skip_matched

fileio.c:192–212  ·  view source on GitHub ↗

An in-place update found identical data at an identical location. We either * just seek past it, or (for an in-place sparse update), we give the data to * the sparse processor with the use_seek flag set. */

Source from the content-addressed store, hash-verified

190 * just seek past it, or (for an in-place sparse update), we give the data to
191 * the sparse processor with the use_seek flag set. */
192int skip_matched(int fd, OFF_T offset, const char *buf, int len)
193{
194 OFF_T pos;
195
196 if (sparse_files > 0) {
197 if (write_file(fd, 1, offset, buf, len) != len)
198 return -1;
199 return 0;
200 }
201
202 if (flush_write_file(fd) < 0)
203 return -1;
204
205 if ((pos = do_lseek(fd, len, SEEK_CUR)) != offset + len) {
206 rsyserr(FERROR_XFER, errno, "lseek returned %s, not %s",
207 big_num(pos), big_num(offset));
208 return -1;
209 }
210
211 return 0;
212}
213
214/* This provides functionality somewhat similar to mmap() but using read().
215 * It gives sliding window access to a file. mmap() is not used because of

Callers 1

receive_dataFunction · 0.85

Calls 5

write_fileFunction · 0.85
flush_write_fileFunction · 0.85
do_lseekFunction · 0.85
big_numFunction · 0.85
rsyserrFunction · 0.70

Tested by

no test coverage detected