rsync 3.4.1 drop-in parity (#285-#297) + parity completion (protocol 2.26.0) #298
@@ -227,8 +227,7 @@ static void digest_to_hex(ChecksumAlgo algo, const uint8_t* digest, size_t len,
|
|||||||
uint64_t high = 0;
|
uint64_t high = 0;
|
||||||
memcpy(&low, digest, sizeof(low));
|
memcpy(&low, digest, sizeof(low));
|
||||||
memcpy(&high, digest + 8, sizeof(high));
|
memcpy(&high, digest + 8, sizeof(high));
|
||||||
snprintf(out, len * 2 + 1, "%016llx%016llx", (unsigned long long)high,
|
snprintf(out, len * 2 + 1, "%016llx%016llx", (unsigned long long)high, (unsigned long long)low);
|
||||||
(unsigned long long)low);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
static const char hex[] = "0123456789abcdef";
|
static const char hex[] = "0123456789abcdef";
|
||||||
|
|||||||
@@ -174,9 +174,8 @@ static void progress_final_frame(unsigned long long size, char* out, size_t out_
|
|||||||
(now.tv_nsec - g_progress_file_start.tv_nsec) / 1000000;
|
(now.tv_nsec - g_progress_file_start.tv_nsec) / 1000000;
|
||||||
if (diff_ms <= 0)
|
if (diff_ms <= 0)
|
||||||
diff_ms = 1;
|
diff_ms = 1;
|
||||||
double rate = size > last_ofs
|
double rate =
|
||||||
? (double)(size - last_ofs) * 1000.0 / (double)diff_ms / 1024.0
|
size > last_ofs ? (double)(size - last_ofs) * 1000.0 / (double)diff_ms / 1024.0 : 0.0;
|
||||||
: 0.0;
|
|
||||||
const char* units = "kB/s";
|
const char* units = "kB/s";
|
||||||
if (rate > 1024.0 * 1024.0) {
|
if (rate > 1024.0 * 1024.0) {
|
||||||
rate /= 1024.0 * 1024.0;
|
rate /= 1024.0 * 1024.0;
|
||||||
@@ -188,7 +187,8 @@ static void progress_final_frame(unsigned long long size, char* out, size_t out_
|
|||||||
unsigned long long remain = (unsigned long long)(diff_ms / 1000);
|
unsigned long long remain = (unsigned long long)(diff_ms / 1000);
|
||||||
snprintf(rembuf, sizeof(rembuf), "%4u:%02u:%02u", (unsigned)(remain / 3600),
|
snprintf(rembuf, sizeof(rembuf), "%4u:%02u:%02u", (unsigned)(remain / 3600),
|
||||||
(unsigned)((remain / 60) % 60), (unsigned)(remain % 60));
|
(unsigned)((remain / 60) % 60), (unsigned)(remain % 60));
|
||||||
unsigned long long to_chk = g_progress_seen > g_progress_xferred ? g_progress_seen - g_progress_xferred : 0;
|
unsigned long long to_chk =
|
||||||
|
g_progress_seen > g_progress_xferred ? g_progress_seen - g_progress_xferred : 0;
|
||||||
snprintf(out, out_size, "\r%15s %3d%% %7.2f%s %s (xfr#%llu, to-chk=%llu/%llu)\n", ofs_buf, 100,
|
snprintf(out, out_size, "\r%15s %3d%% %7.2f%s %s (xfr#%llu, to-chk=%llu/%llu)\n", ofs_buf, 100,
|
||||||
rate, units, rembuf, g_progress_xferred, to_chk, g_progress_seen);
|
rate, units, rembuf, g_progress_xferred, to_chk, g_progress_seen);
|
||||||
}
|
}
|
||||||
@@ -1716,7 +1716,8 @@ static int send_dry_run_remote(Config* config) {
|
|||||||
the terminal FINISHED. */
|
the terminal FINISHED. */
|
||||||
bool early_delete = config->use_delete && config_delete_timing_early(config);
|
bool early_delete = config->use_delete && config_delete_timing_early(config);
|
||||||
if (dry_manifest) {
|
if (dry_manifest) {
|
||||||
if (send_delete_manifest(client->file_descriptor, dry_manifest, NULL, NULL, NULL, dry_dirs) != 0)
|
if (send_delete_manifest(client->file_descriptor, dry_manifest, NULL, NULL, NULL, dry_dirs) !=
|
||||||
|
0)
|
||||||
goto dry_fail;
|
goto dry_fail;
|
||||||
if (early_delete) {
|
if (early_delete) {
|
||||||
Status ack;
|
Status ack;
|
||||||
|
|||||||
+10
-3
@@ -71,7 +71,8 @@ bool receiver_send_stats_frame(int fd, const Config* config, const ReceiverStats
|
|||||||
count = MAX_MANIFEST_ENTRIES;
|
count = MAX_MANIFEST_ENTRIES;
|
||||||
ReceiverStats record = *out;
|
ReceiverStats record = *out;
|
||||||
record.would_delete_count = count;
|
record.would_delete_count = count;
|
||||||
if (!send_status(fd, STATUS_STATS) || !format_stats_send(fd, &record) || !send_int(fd, (int)count))
|
if (!send_status(fd, STATUS_STATS) || !format_stats_send(fd, &record) ||
|
||||||
|
!send_int(fd, (int)count))
|
||||||
return false;
|
return false;
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
const char* path = (const char*)would_delete->items[i];
|
const char* path = (const char*)would_delete->items[i];
|
||||||
@@ -579,8 +580,14 @@ int receiver_receive_files(Config* config, int file_descriptor) {
|
|||||||
context.would_delete = array_list_create(free);
|
context.would_delete = array_list_create(free);
|
||||||
if (!context.would_delete)
|
if (!context.would_delete)
|
||||||
return -1;
|
return -1;
|
||||||
ReceiverSink sink = {receiver_save_file, &context, true, true, receiver_send_success_frame,
|
ReceiverSink sink = {receiver_save_file,
|
||||||
receiver_note_delete_limit, &context.stats, context.would_delete};
|
&context,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
receiver_send_success_frame,
|
||||||
|
receiver_note_delete_limit,
|
||||||
|
&context.stats,
|
||||||
|
context.would_delete};
|
||||||
int ret = receiver_process(config, file_descriptor, &sink);
|
int ret = receiver_process(config, file_descriptor, &sink);
|
||||||
if (ret != 0 && config->delay_updates && config->delay_context)
|
if (ret != 0 && config->delay_updates && config->delay_context)
|
||||||
delay_updates_cleanup(config->delay_context);
|
delay_updates_cleanup(config->delay_context);
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ bool checksum_digest(ChecksumAlgo algo, uint64_t seed, const void* data, size_t
|
|||||||
bool checksum_digest_file(ChecksumAlgo algo, uint64_t seed, const char* path, uint8_t* out,
|
bool checksum_digest_file(ChecksumAlgo algo, uint64_t seed, const char* path, uint8_t* out,
|
||||||
size_t out_capacity, size_t* out_len);
|
size_t out_capacity, size_t* out_len);
|
||||||
|
|
||||||
/* Resolve a --checksum-choice string (case-insensitive) to an algorithm id. * Accepts "xxh64"/"xxhash", "xxh3", "xxh128" and "md5". "auto", rsync's
|
/* Resolve a --checksum-choice string (case-insensitive) to an algorithm id. * Accepts
|
||||||
* default automatic choice, is resolved to the default by the caller (it is not
|
* "xxh64"/"xxhash", "xxh3", "xxh128" and "md5". "auto", rsync's default automatic choice, is
|
||||||
* a distinct algorithm here). Returns -1 for any name FastSync does not
|
* resolved to the default by the caller (it is not a distinct algorithm here). Returns -1 for any
|
||||||
* implement (md4/sha1/none included). */
|
* name FastSync does not implement (md4/sha1/none included). */
|
||||||
int checksum_algo_from_name(const char* name);
|
int checksum_algo_from_name(const char* name);
|
||||||
|
|
||||||
/* Canonical name of an algorithm (used in CLI error messages). */
|
/* Canonical name of an algorithm (used in CLI error messages). */
|
||||||
|
|||||||
@@ -3300,8 +3300,8 @@ bool manifest_would_delete_list(const Config* config, DeleteManifest* manifest,
|
|||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool ok = delete_extras_list(config->receive_root_directory, manifest->keeps, manifest->dirs, skips,
|
bool ok = delete_extras_list(config->receive_root_directory, manifest->keeps, manifest->dirs,
|
||||||
skip_count, out, count_out);
|
skips, skip_count, out, count_out);
|
||||||
free(skips);
|
free(skips);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -119,8 +119,7 @@ bool format_stats_receive(int fd, ReceiverStats* stats) {
|
|||||||
unsigned long long deleted = 0;
|
unsigned long long deleted = 0;
|
||||||
unsigned long long would = 0;
|
unsigned long long would = 0;
|
||||||
if (!receive_n_data(fd, &matched, sizeof(matched)) ||
|
if (!receive_n_data(fd, &matched, sizeof(matched)) ||
|
||||||
!receive_n_data(fd, &deleted, sizeof(deleted)) ||
|
!receive_n_data(fd, &deleted, sizeof(deleted)) || !receive_n_data(fd, &would, sizeof(would)))
|
||||||
!receive_n_data(fd, &would, sizeof(would)))
|
|
||||||
return false;
|
return false;
|
||||||
memset(stats, 0, sizeof(*stats));
|
memset(stats, 0, sizeof(*stats));
|
||||||
stats->matched_data = matched;
|
stats->matched_data = matched;
|
||||||
|
|||||||
+2
-2
@@ -768,8 +768,8 @@ static bool list_extras_fd(int dirfd, const char* rel_path, const PathIndex* kee
|
|||||||
int childfd = openat(dirfd, entry->d_name, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
|
int childfd = openat(dirfd, entry->d_name, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
|
||||||
bool child_all_removed = false;
|
bool child_all_removed = false;
|
||||||
if (childfd >= 0) {
|
if (childfd >= 0) {
|
||||||
if (!list_extras_fd(childfd, child_rel, keep, dirs, out, recorded, skips, skip_count, deletable,
|
if (!list_extras_fd(childfd, child_rel, keep, dirs, out, recorded, skips, skip_count,
|
||||||
&child_all_removed))
|
deletable, &child_all_removed))
|
||||||
operation_ok = false;
|
operation_ok = false;
|
||||||
close(childfd);
|
close(childfd);
|
||||||
} else if (errno != ENOENT) {
|
} else if (errno != ENOENT) {
|
||||||
|
|||||||
Reference in New Issue
Block a user