version 1.12, 2019/02/16 10:48:05 |
version 1.13, 2019/02/16 16:57:17 |
|
|
#define CSUM_LENGTH_PHASE1 (2) |
#define CSUM_LENGTH_PHASE1 (2) |
#define CSUM_LENGTH_PHASE2 (16) |
#define CSUM_LENGTH_PHASE2 (16) |
|
|
|
#define POLL_TIMEOUT (10000) |
|
|
/* |
/* |
* Operating mode for a client or a server. |
* Operating mode for a client or a server. |
* Sender means we synchronise local files with those from remote. |
* Sender means we synchronise local files with those from remote. |
|
|
}; |
}; |
|
|
/* |
/* |
|
* Information for the sender updating receiver blocks reentrantly. |
|
*/ |
|
struct blkstat { |
|
off_t offs; /* position in sender file */ |
|
off_t total; /* total amount processed */ |
|
off_t dirty; /* total amount sent */ |
|
size_t hint; /* optimisation: next probable block match */ |
|
void *map; /* mapped file or MAP_FAILED otherwise */ |
|
size_t mapsz; /* size of file or zero */ |
|
int fd; /* descriptor girding the map */ |
|
}; |
|
|
|
/* |
* When transferring file contents, we break the file down into blocks |
* When transferring file contents, we break the file down into blocks |
* and work with those. |
* and work with those. |
*/ |
*/ |
|
|
struct blkset *blk_recv(struct sess *, int, const char *); |
struct blkset *blk_recv(struct sess *, int, const char *); |
int blk_recv_ack(struct sess *, |
int blk_recv_ack(struct sess *, |
int, const struct blkset *, int32_t); |
int, const struct blkset *, int32_t); |
int blk_match(struct sess *, int, |
int blk_match(struct sess *, int, const struct blkset *, |
const struct blkset *, const char *); |
const char *, struct blkstat *); |
int blk_send(struct sess *, int, size_t, |
int blk_send(struct sess *, int, size_t, |
const struct blkset *, const char *); |
const struct blkset *, const char *); |
int blk_send_ack(struct sess *, int, struct blkset *); |
int blk_send_ack(struct sess *, int, struct blkset *); |
int blk_merge(struct sess *, int, int, |
|
const struct blkset *, int, const char *, |
|
const void *, size_t, float *); |
|
void blkset_free(struct blkset *); |
|
|
|
uint32_t hash_fast(const void *, size_t); |
uint32_t hash_fast(const void *, size_t); |
void hash_slow(const void *, size_t, |
void hash_slow(const void *, size_t, |