X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/72e5645e95d7fd7edd0c4ab59f9812b9d6124521..5214a41bbae94607b196b199b483710e1babf292:/checksum-reading.diff diff --git a/checksum-reading.diff b/checksum-reading.diff index 3e8748d..214f8a4 100644 --- a/checksum-reading.diff +++ b/checksum-reading.diff @@ -16,7 +16,7 @@ To use this patch, run these commands for a successful build: ./configure (optional if already run) make -based-on: 3b8f8192227b14e708bf535072485e50f4362270 +based-on: 24079e988fc31af4eba56cd2701fdc5a4154980d diff --git a/checksum.c b/checksum.c --- a/checksum.c +++ b/checksum.c @@ -41,7 +41,7 @@ diff --git a/clientserver.c b/clientserver.c extern int io_timeout; extern int no_detach; extern int write_batch; -@@ -871,6 +873,9 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char +@@ -874,6 +876,9 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char } else if (am_root < 0) /* Treat --fake-super from client as --super. */ am_root = 2; @@ -70,7 +70,7 @@ diff --git a/flist.c b/flist.c extern int module_id; extern int ignore_errors; extern int numeric_ids; -@@ -61,6 +63,7 @@ extern int file_extra_cnt; +@@ -60,6 +62,7 @@ extern int file_extra_cnt; extern int ignore_perishable; extern int non_perishable_cnt; extern int prune_empty_dirs; @@ -78,7 +78,7 @@ diff --git a/flist.c b/flist.c extern int copy_links; extern int copy_unsafe_links; extern int protocol_version; -@@ -71,6 +74,7 @@ extern int sender_symlink_iconv; +@@ -70,6 +73,7 @@ extern int sender_symlink_iconv; extern int output_needs_newline; extern int sender_keeps_checksum; extern int unsort_ndx; @@ -86,7 +86,7 @@ diff --git a/flist.c b/flist.c extern struct stats stats; extern char *filesfrom_host; extern char *usermap, *groupmap; -@@ -95,6 +99,12 @@ extern iconv_t ic_send, ic_recv; +@@ -94,6 +98,12 @@ extern iconv_t ic_send, ic_recv; #endif #endif @@ -99,7 +99,7 @@ diff --git a/flist.c b/flist.c #define PTR_SIZE (sizeof (struct file_struct *)) int io_error; -@@ -136,7 +146,11 @@ static char tmp_sum[MAX_DIGEST_LEN]; +@@ -135,7 +145,11 @@ static char tmp_sum[MAX_DIGEST_LEN]; static char empty_sum[MAX_DIGEST_LEN]; static int flist_count_offset; /* for --delete --progress */ @@ -112,7 +112,7 @@ diff --git a/flist.c b/flist.c static void output_flist(struct file_list *flist); void init_flist(void) -@@ -351,6 +365,238 @@ static void flist_done_allocating(struct file_list *flist) +@@ -350,6 +364,238 @@ static void flist_done_allocating(struct file_list *flist) flist->pool_boundary = ptr; } @@ -351,7 +351,7 @@ diff --git a/flist.c b/flist.c /* Call this with EITHER (1) "file, NULL, 0" to chdir() to the file's * F_PATHNAME(), or (2) "NULL, dir, dirlen" to chdir() to the supplied dir, * with dir == NULL taken to be the starting directory, and dirlen < 0 -@@ -1142,7 +1388,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, +@@ -1141,7 +1387,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, STRUCT_STAT *stp, int flags, int filter_level) { static char *lastdir; @@ -360,7 +360,7 @@ diff --git a/flist.c b/flist.c struct file_struct *file; char thisname[MAXPATHLEN]; char linkname[MAXPATHLEN]; -@@ -1288,9 +1534,16 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, +@@ -1287,9 +1533,16 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, memcpy(lastdir, thisname, len); lastdir[len] = '\0'; lastdir_len = len; @@ -378,7 +378,7 @@ diff --git a/flist.c b/flist.c basename_len = strlen(basename) + 1; /* count the '\0' */ #ifdef SUPPORT_LINKS -@@ -1308,11 +1561,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, +@@ -1307,11 +1560,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, extra_len += EXTRA_LEN; #endif @@ -392,7 +392,7 @@ diff --git a/flist.c b/flist.c #if EXTRA_ROUNDING > 0 if (extra_len & (EXTRA_ROUNDING * EXTRA_LEN)) -@@ -1395,8 +1645,14 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, +@@ -1394,8 +1644,14 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, return NULL; } @@ -409,7 +409,7 @@ diff --git a/flist.c b/flist.c if (unsort_ndx) F_NDX(file) = stats.num_dirs; -@@ -2518,7 +2774,7 @@ struct file_list *recv_file_list(int f) +@@ -2527,7 +2783,7 @@ struct file_list *recv_file_list(int f) rprintf(FINFO, "[%s] flist_eof=1\n", who_am_i()); } @@ -418,7 +418,7 @@ diff --git a/flist.c b/flist.c if (protocol_version < 30) { /* Recv the io_error flag */ -@@ -2741,7 +2997,7 @@ void flist_free(struct file_list *flist) +@@ -2750,7 +3006,7 @@ void flist_free(struct file_list *flist) /* This routine ensures we don't have any duplicate names in our file list. * duplicate names can cause corruption because of the pipelining. */ @@ -427,7 +427,7 @@ diff --git a/flist.c b/flist.c { char fbuf[MAXPATHLEN]; int i, prev_i; -@@ -2792,7 +3048,7 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root) +@@ -2801,7 +3057,7 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root) /* If one is a dir and the other is not, we want to * keep the dir because it might have contents in the * list. Otherwise keep the first one. */ @@ -436,7 +436,7 @@ diff --git a/flist.c b/flist.c struct file_struct *fp = flist->sorted[j]; if (!S_ISDIR(fp->mode)) keep = i, drop = j; -@@ -2808,8 +3064,8 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root) +@@ -2817,8 +3073,8 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root) } else keep = j, drop = i; @@ -447,7 +447,7 @@ diff --git a/flist.c b/flist.c rprintf(FINFO, "removing duplicate name %s from file list (%d)\n", f_name(file, fbuf), drop + flist->ndx_start); -@@ -2831,7 +3087,7 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root) +@@ -2840,7 +3096,7 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root) } flist->high = prev_i; @@ -467,7 +467,7 @@ diff --git a/generator.c b/generator.c extern int remove_source_files; extern int delay_updates; extern int update_only; -@@ -523,7 +524,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre +@@ -522,7 +523,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre /* Perform our quick-check heuristic for determining if a file is unchanged. */ @@ -476,7 +476,7 @@ diff --git a/generator.c b/generator.c { if (st->st_size != F_LENGTH(file)) return 0; -@@ -532,7 +533,10 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st) +@@ -531,7 +532,10 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st) of the file time to determine whether to sync */ if (always_checksum > 0 && S_ISREG(st->st_mode)) { char sum[MAX_DIGEST_LEN]; @@ -488,7 +488,7 @@ diff --git a/generator.c b/generator.c return memcmp(sum, F_SUM(file), checksum_len) == 0; } -@@ -796,7 +800,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx, +@@ -795,7 +799,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx, match_level = 1; /* FALL THROUGH */ case 1: @@ -497,7 +497,7 @@ diff --git a/generator.c b/generator.c continue; best_match = j; match_level = 2; -@@ -1082,7 +1086,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, +@@ -1081,7 +1085,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, * --ignore-non-existing, daemon exclude, or mkdir failure. */ static struct file_struct *skip_dir = NULL; static struct file_list *fuzzy_dirlist = NULL; @@ -506,7 +506,7 @@ diff --git a/generator.c b/generator.c struct file_struct *fuzzy_file = NULL; int fd = -1, f_copy = -1; stat_x sx, real_sx; -@@ -1166,8 +1170,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, +@@ -1165,8 +1169,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, flist_free(fuzzy_dirlist); fuzzy_dirlist = NULL; } @@ -517,7 +517,7 @@ diff --git a/generator.c b/generator.c #ifdef SUPPORT_ACLS if (!preserve_perms) dflt_perms = default_perms_for_dir(dn); -@@ -1175,10 +1179,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, +@@ -1174,10 +1178,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } parent_dirname = dn; @@ -537,7 +537,7 @@ diff --git a/generator.c b/generator.c } statret = link_stat(fname, &sx.st, keep_dirlinks && is_dir); -@@ -1601,7 +1610,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, +@@ -1600,7 +1609,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, ; else if (fnamecmp_type == FNAMECMP_FUZZY) ; @@ -549,7 +549,7 @@ diff --git a/generator.c b/generator.c diff --git a/hlink.c b/hlink.c --- a/hlink.c +++ b/hlink.c -@@ -410,7 +410,7 @@ int hard_link_check(struct file_struct *file, int ndx, char *fname, +@@ -409,7 +409,7 @@ int hard_link_check(struct file_struct *file, int ndx, char *fname, } break; } @@ -642,15 +642,15 @@ diff --git a/options.c b/options.c rprintf(F," -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)\n"); rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n"); rprintf(F," -r, --recursive recurse into directories\n"); -@@ -799,7 +801,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM, +@@ -798,7 +800,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM, + 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_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, -- OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, -+ OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_SUMFILES, +- OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, ++ OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, OPT_SUMFILES, + OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT, OPT_SERVER, OPT_REFUSED_BASE = 9000}; - static struct poptOption long_options[] = { @@ -934,6 +936,7 @@ static struct poptOption long_options[] = { {"checksum", 'c', POPT_ARG_VAL, &always_checksum, 1, 0, 0 }, {"no-checksum", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 }, @@ -659,7 +659,7 @@ diff --git a/options.c b/options.c {"block-size", 'B', POPT_ARG_LONG, &block_size, 0, 0, 0 }, {"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 }, {"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 }, -@@ -1632,6 +1635,23 @@ int parse_arguments(int *argc_p, const char ***argv_p) +@@ -1651,6 +1654,23 @@ int parse_arguments(int *argc_p, const char ***argv_p) } break; @@ -683,7 +683,7 @@ diff --git a/options.c b/options.c case OPT_INFO: arg = poptGetOptArg(pc); parse_output_words(info_words, info_levels, arg, USER_PRIORITY); -@@ -1832,6 +1852,9 @@ int parse_arguments(int *argc_p, const char ***argv_p) +@@ -1851,6 +1871,9 @@ int parse_arguments(int *argc_p, const char ***argv_p) } #endif @@ -696,7 +696,7 @@ diff --git a/options.c b/options.c diff --git a/rsync.h b/rsync.h --- a/rsync.h +++ b/rsync.h -@@ -723,6 +723,10 @@ extern int xattrs_ndx; +@@ -727,6 +727,10 @@ extern int xattrs_ndx; #define F_SUM(f) ((char*)OPT_EXTRA(f, START_BUMP(f) + HLINK_BUMP(f) \ + SUM_EXTRA_CNT - 1)) @@ -707,7 +707,7 @@ diff --git a/rsync.h b/rsync.h /* Some utility defines: */ #define F_IS_ACTIVE(f) (f)->basename[0] #define F_IS_HLINKED(f) ((f)->flags & FLAG_HLINKED) -@@ -911,6 +915,13 @@ typedef struct { +@@ -923,6 +927,13 @@ typedef struct { char fname[1]; /* has variable size */ } relnamecache;