Line data Source code
1 : #include "../../burp.h"
2 : #include "../backup_phase1.h"
3 :
4 : #include <librsync.h>
5 : #include <math.h>
6 :
7 : /* Need to base librsync block length on the size of the old file, otherwise
8 : the risk of librsync collisions and silent corruption increases as the
9 : size of the new file gets bigger. */
10 0 : size_t get_librsync_block_len(const char *endfile)
11 : {
12 0 : size_t ret=0;
13 0 : uint64_t oldlen=0;
14 0 : oldlen=strtoull(endfile, NULL, 10);
15 0 : ret=(size_t)(ceil(sqrt(oldlen)/16)*16); // round to a multiple of 16.
16 0 : if(ret<64) return 64; // minimum of 64 bytes.
17 0 : return ret;
18 : }
|