sum_init(checksum_seed);
if (append_mode > 0) {
- OFF_T j = 0;
- for (j = CHUNK_SIZE; j < s->flength; j += CHUNK_SIZE) {
- if (buf && do_progress)
- show_progress(last_match, buf->file_size);
- sum_update(map_ptr(buf, last_match, CHUNK_SIZE),
- CHUNK_SIZE);
- last_match = j;
- }
- if (last_match < s->flength) {
- int32 n = (int32)(s->flength - last_match);
- if (buf && do_progress)
- show_progress(last_match, buf->file_size);
- sum_update(map_ptr(buf, last_match, n), n);
- last_match = s->flength;
+ if (append_mode == 2) {
+ OFF_T j = 0;
+ for (j = CHUNK_SIZE; j < s->flength; j += CHUNK_SIZE) {
+ if (buf && do_progress)
+ show_progress(last_match, buf->file_size);
+ sum_update(map_ptr(buf, last_match, CHUNK_SIZE),
+ CHUNK_SIZE);
+ last_match = j;
+ }
+ if (last_match < s->flength) {
+ int32 n = (int32)(s->flength - last_match);
+ if (buf && do_progress)
+ show_progress(last_match, buf->file_size);
+ sum_update(map_ptr(buf, last_match, n), n);
+ }
}
+ last_match = s->flength;
s->count = 0;
}
rprintf(F," -u, --update skip files that are newer on the receiver\n");
rprintf(F," --inplace update destination files in-place (SEE MAN PAGE)\n");
rprintf(F," --append append data onto shorter files\n");
+ rprintf(F," --append-verify like --append, but with old data in file checksum\n");
rprintf(F," -d, --dirs transfer directories without recursing\n");
rprintf(F," -l, --links copy symlinks as symlinks\n");
rprintf(F," -L, --copy-links transform symlink into referent file/dir\n");
OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
- OPT_NO_D,
+ OPT_NO_D, OPT_APPEND,
OPT_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
{"min-size", 0, POPT_ARG_STRING, &min_size_arg, OPT_MIN_SIZE, 0, 0 },
{"sparse", 'S', POPT_ARG_NONE, &sparse_files, 0, 0, 0 },
{"inplace", 0, POPT_ARG_NONE, &inplace, 0, 0, 0 },
- {"append", 0, POPT_ARG_VAL, &append_mode, 1, 0, 0 },
+ {"append", 0, POPT_ARG_NONE, 0, OPT_APPEND, 0, 0 },
+ {"append-verify", 0, POPT_ARG_VAL, &append_mode, 2, 0, 0 },
+ {"no-append", 0, POPT_ARG_VAL, &append_mode, 0, 0, 0 },
{"del", 0, POPT_ARG_NONE, &delete_during, 0, 0, 0 },
{"delete", 0, POPT_ARG_NONE, &delete_mode, 0, 0, 0 },
{"delete-before", 0, POPT_ARG_NONE, &delete_before, 0, 0, 0 },
}
break;
+ case OPT_APPEND:
+ if (am_server)
+ append_mode++;
+ else
+ append_mode = 1;
+ break;
+
case OPT_LINK_DEST:
#ifdef SUPPORT_HARD_LINKS
link_dest = 1;
}
}
- if (append_mode)
+ if (append_mode) {
+ if (append_mode > 1)
+ args[ac++] = "--append";
args[ac++] = "--append";
- else if (inplace)
+ } else if (inplace)
args[ac++] = "--inplace";
if (files_from && (!am_sender || filesfrom_host)) {
sum.flength = (OFF_T)sum.count * sum.blength;
if (sum.remainder)
sum.flength -= sum.blength - sum.remainder;
- for (j = CHUNK_SIZE; j < sum.flength; j += CHUNK_SIZE) {
- if (do_progress)
- show_progress(offset, total_size);
- sum_update(map_ptr(mapbuf, offset, CHUNK_SIZE),
- CHUNK_SIZE);
- offset = j;
- }
- if (offset < sum.flength) {
- int32 len = (int32)(sum.flength - offset);
- if (do_progress)
- show_progress(offset, total_size);
- sum_update(map_ptr(mapbuf, offset, len), len);
- offset = sum.flength;
+ if (append_mode == 2) {
+ for (j = CHUNK_SIZE; j < sum.flength; j += CHUNK_SIZE) {
+ if (do_progress)
+ show_progress(offset, total_size);
+ sum_update(map_ptr(mapbuf, offset, CHUNK_SIZE),
+ CHUNK_SIZE);
+ offset = j;
+ }
+ if (offset < sum.flength) {
+ int32 len = (int32)(sum.flength - offset);
+ if (do_progress)
+ show_progress(offset, total_size);
+ sum_update(map_ptr(mapbuf, offset, len), len);
+ }
}
+ offset = sum.flength;
if (fd != -1 && (j = do_lseek(fd, offset, SEEK_SET)) != offset) {
rsyserr(FERROR, errno, "lseek of %s returned %.0f, not %.0f",
full_fname(fname), (double)j, (double)offset);
if (csum_length == SHORT_SUM_LENGTH) {
if (keep_partial && !partial_dir)
make_backups = -make_backups; /* prevents double backup */
+ if (append_mode)
+ sparse_files = -sparse_files;
append_mode = -append_mode;
- sparse_files = -sparse_files;
csum_length = SUM_LENGTH;
redoing = 1;
}
if (csum_length != SHORT_SUM_LENGTH) {
if (keep_partial && !partial_dir)
make_backups = -make_backups;
+ if (append_mode)
+ sparse_files = -sparse_files;
append_mode = -append_mode;
- sparse_files = -sparse_files;
csum_length = SHORT_SUM_LENGTH;
redoing = 0;
}