MCPcopy Create free account
hub / github.com/RsyncProject/rsync / map_file

Function map_file

fileio.c:218–232  ·  view source on GitHub ↗

This provides functionality somewhat similar to mmap() but using read(). * It gives sliding window access to a file. mmap() is not used because of * the possibility of another program (such as a mailer) truncating the * file thus giving us a SIGBUS. */

Source from the content-addressed store, hash-verified

216 * the possibility of another program (such as a mailer) truncating the
217 * file thus giving us a SIGBUS. */
218struct map_struct *map_file(int fd, OFF_T len, int32 read_size, int32 blk_size)
219{
220 struct map_struct *map;
221
222 map = new0(struct map_struct);
223
224 if (blk_size && (read_size % blk_size))
225 read_size += blk_size - (read_size % blk_size);
226
227 map->fd = fd;
228 map->file_size = len;
229 map->def_window_size = ALIGNED_LENGTH(read_size);
230
231 return map;
232}
233
234
235/* slide the read window in the file */

Callers 4

send_filesFunction · 0.85
file_checksumFunction · 0.85
generate_and_send_sumsFunction · 0.85
receive_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected