46 #ifndef HASHTABLE_NSTATS
66 size_t block_len,
size_t strong_len,
74 rs_weak_sum_t weak_sum,
75 rs_strong_sum_t *strong_sum);
78 rs_long_t rs_signature_find_match(
rs_signature_t *sig, rs_weak_sum_t weak_sum,
79 void const *buf,
size_t len);
85 #define rs_sig_args_check(magic, block_len, strong_len) do {\
86 assert(((magic) & 0xffffff00) == (RS_MD4_SIG_MAGIC & 0xffffff00));\
87 assert(((magic) & 0xf0) == 0x30 || ((magic) & 0xf0) == 0x40);\
88 assert((((magic) & 0x0f) == 0x06 &&\
89 (strong_len) <= RS_MD4_SUM_LENGTH) ||\
90 (((magic) & 0x0f) == 0x07 &&\
91 (strong_len) <= RS_BLAKE2_SUM_LENGTH));\
92 assert(0 < (block_len));\
93 assert(0 < (strong_len) && (strong_len) <= RS_MAX_STRONG_SUM_LENGTH);\
100 #define rs_signature_check(sig) do {\
101 rs_sig_args_check((sig)->magic, (sig)->block_len, (sig)->strong_sum_len);\
102 assert(0 <= (sig)->count && (sig)->count <= (sig)->size);\
103 assert(!(sig)->hashtable || (sig)->hashtable->count <= (sig)->count);\
107 static inline weaksum_kind_t rs_signature_weaksum_kind(
rs_signature_t const
110 return (sig->
magic & 0xf0) == 0x30 ? RS_ROLLSUM : RS_RABINKARP;
114 static inline strongsum_kind_t rs_signature_strongsum_kind(
rs_signature_t const
117 return (sig->
magic & 0x0f) == 0x06 ? RS_MD4 : RS_BLAKE2;
121 static inline rs_weak_sum_t rs_signature_calc_weak_sum(
rs_signature_t const
122 *sig,
void const *buf,
125 return rs_calc_weak_sum(rs_signature_weaksum_kind(sig), buf, len);
129 static inline void rs_signature_calc_strong_sum(
rs_signature_t const *sig,
130 void const *buf,
size_t len,
131 rs_strong_sum_t *sum)
133 rs_calc_strong_sum(rs_signature_strongsum_kind(sig), buf, len, sum);
int size
Total number of blocks allocated.
hashtable_t * hashtable
The hashtable for finding matches.
int count
Total number of blocks.
int block_len
The block length.
rs_weak_sum_t weak_sum
Block's weak checksum.
int strong_sum_len
The block strong sum length.
void * block_sigs
The packed block_sigs for all blocks.
Signature of a whole file.
rs_result
Return codes from nonblocking rsync operations.
int magic
The signature magic value.
long calc_strong_count
The count of strongsum calcs done.
Signature of a single block.
rs_magic_number
A uint32 magic number, emitted in bigendian/network order at the start of librsync files...
A generic open addressing hashtable.
rs_strong_sum_t strong_sum
Block's strong checksum.