-Depends-On-Patch: g2r-basis-filename.diff
-
This patch allows multiple --compare-dest or --link-dest options to be
used, making the transfer of some files more optimal. Note that the
algorithm does NOT search for the best match -- it stops at the first
Before compiling, be sure to run "make proto".
---- orig/generator.c 2004-10-09 04:06:49
-+++ generator.c 2004-10-09 03:35:50
+--- orig/generator.c 2004-11-03 20:30:45
++++ generator.c 2004-11-03 22:47:23
@@ -45,7 +45,7 @@ extern int io_timeout;
extern int protocol_version;
extern int always_checksum;
extern int local_server;
@@ -424,11 +424,19 @@ static void recv_generator(char *fname,
fnamecmp = fname;
- fnamecmp_type = G2R_FNAME;
+ fnamecmp_type = FNAMECMP_FNAME;
- if (statret == -1 && compare_dest != NULL) {
+ if (statret == -1 && compare_dest[0] != NULL) {
safe_fname(fname));
}
fnamecmp = fnamecmpbuf;
-- fnamecmp_type = 0;
-+ fnamecmp_type = i;
+- fnamecmp_type = FNAMECMP_CMPDEST;
++ fnamecmp_type = FNAMECMP_CMPDEST + i;
}
} else
#endif
{
fnamecmp = fnamecmpbuf;
-- fnamecmp_type = 0;
-+ fnamecmp_type = i;
+- fnamecmp_type = FNAMECMP_CMPDEST;
++ fnamecmp_type = FNAMECMP_CMPDEST + i;
}
- statret = 0;
}
}
---- orig/main.c 2004-10-09 03:25:43
+--- orig/main.c 2004-11-03 20:30:45
+++ main.c 2004-07-30 07:23:54
@@ -59,7 +59,7 @@ extern int filesfrom_fd;
extern pid_t cleanup_child_pid;
}
if (files_from && (!am_sender || remote_filesfrom_file)) {
---- orig/receiver.c 2004-09-07 21:57:20
-+++ receiver.c 2004-07-30 07:31:12
-@@ -38,7 +38,7 @@ extern int cvs_exclude;
+--- orig/receiver.c 2004-11-03 20:30:45
++++ receiver.c 2004-11-03 22:50:43
+@@ -39,7 +39,7 @@ extern int cvs_exclude;
extern int io_error;
extern char *tmpdir;
extern char *partial_dir;
extern int make_backups;
extern int do_progress;
extern char *backup_dir;
-@@ -438,7 +438,8 @@ int recv_files(int f_in, struct file_lis
+@@ -439,7 +439,8 @@ int recv_files(int f_in, struct file_lis
partialptr = partial_dir ? partial_dir_fname(fname) : fname;
if (f_in_name >= 0) {
- switch (read_byte(f_in_name)) {
+ uchar j;
+ switch (j = read_byte(f_in_name)) {
- case G2R_FNAME:
+ case FNAMECMP_FNAME:
fnamecmp = fname;
break;
-@@ -450,7 +451,7 @@ int recv_files(int f_in, struct file_lis
- break;
+@@ -452,7 +453,7 @@ int recv_files(int f_in, struct file_lis
+ case FNAMECMP_CMPDEST:
default:
pathjoin(fnamecmpbuf, sizeof fnamecmpbuf,
- compare_dest, fname);
fnamecmp = fnamecmpbuf;
break;
}
---- orig/rsync.h 2004-09-07 21:52:22
+--- orig/rsync.h 2004-11-03 20:30:45
+++ rsync.h 2004-07-30 07:23:54
@@ -98,6 +98,8 @@
-Depends-On-Patch: g2r-basis-filename.diff
-
The changes to generator.c were greatly simplified, making the patch
easier to maintain and fixing the failing test in the testsuite.
Very lightly tested.
Be sure to run "make proto" before "make".
---- orig/generator.c 2004-10-09 04:06:49
-+++ generator.c 2004-09-23 15:33:08
+--- orig/generator.c 2004-11-03 20:30:45
++++ generator.c 2004-11-03 22:52:53
@@ -43,6 +43,7 @@ extern int ignore_times;
extern int size_only;
extern int io_timeout;
+ && S_ISREG(st.st_mode)) {
+ statret = 0;
+ fnamecmp = fnamecmpbuf;
-+ fnamecmp_type = G2R_FUZZY;
++ fnamecmp_type = FNAMECMP_FUZZY;
+ }
+ }
+
}
- if (skip_file(fnamecmp, file, &st)) {
-+ if (fnamecmp_type != G2R_FUZZY && skip_file(fnamecmp, file, &st)) {
- if (fnamecmp_type == G2R_FNAME)
++ if (fnamecmp_type != FNAMECMP_FUZZY && skip_file(fnamecmp, file, &st)) {
+ if (fnamecmp_type == FNAMECMP_FNAME)
set_perms(fname, file, &st, PERMS_REPORT);
return;
-@@ -564,6 +660,21 @@ prepare_to_open:
+@@ -563,8 +659,24 @@ prepare_to_open:
+
notify_others:
- if (f_out_name >= 0) {
+ write_int(f_out, i);
+- if (f_out_name >= 0)
++ if (f_out_name >= 0) {
write_byte(f_out_name, fnamecmp_type);
-+ if (fnamecmp_type == G2R_FUZZY) {
++ if (fnamecmp_type == FNAMECMP_FUZZY) {
+ uchar lenbuf[3], *lb = lenbuf;
+ int len = strlen(fnamecmpbuf);
+ if (len > 0x7F) {
+ write_buf(f_out_name, lenbuf, lb - lenbuf + 1);
+ write_buf(f_out_name, fnamecmpbuf, len);
+ }
- io_flush(NORMAL_FLUSH); /* XXX make this more efficient! */
- }
++ }
---- orig/main.c 2004-10-09 03:25:43
+ if (dry_run || read_batch)
+ return;
+--- orig/main.c 2004-11-03 20:30:45
+++ main.c 2004-07-22 00:32:31
@@ -48,6 +48,7 @@ extern int keep_dirlinks;
extern int preserve_hard_links;
*argc = ac;
return;
---- orig/receiver.c 2004-09-07 21:57:20
-+++ receiver.c 2004-07-30 18:21:38
-@@ -319,6 +319,27 @@ static int receive_data(int f_in, char *
+--- orig/receiver.c 2004-11-03 20:30:45
++++ receiver.c 2004-11-03 22:54:05
+@@ -320,6 +320,27 @@ static int receive_data(int f_in, char *
}
static void discard_receive_data(int f_in, OFF_T length)
{
receive_data(f_in, NULL, -1, 0, NULL, -1, length);
-@@ -448,6 +469,10 @@ int recv_files(int f_in, struct file_lis
- case G2R_BACKUP:
+@@ -449,6 +470,10 @@ int recv_files(int f_in, struct file_lis
+ case FNAMECMP_BACKUP:
fnamecmp = get_backup_name(fname);
break;
-+ case G2R_FUZZY:
++ case FNAMECMP_FUZZY:
+ read_gen_name(f_in_name, fnamecmpbuf);
+ fnamecmp = fnamecmpbuf;
+ break;
+ case FNAMECMP_CMPDEST:
default:
pathjoin(fnamecmpbuf, sizeof fnamecmpbuf,
- compare_dest, fname);
---- orig/rsync.h 2004-09-07 21:52:22
-+++ rsync.h 2004-09-07 22:02:37
-@@ -122,6 +122,7 @@
- #define G2R_FNAME 0x80
- #define G2R_PARTIAL_DIR 0x81
- #define G2R_BACKUP 0x82
-+#define G2R_FUZZY 0x83
+--- orig/rsync.h 2004-11-03 20:30:45
++++ rsync.h 2004-11-03 22:53:09
+@@ -123,6 +123,7 @@
+ #define FNAMECMP_FNAME 0x80
+ #define FNAMECMP_PARTIAL_DIR 0x81
+ #define FNAMECMP_BACKUP 0x82
++#define FNAMECMP_FUZZY 0x83
/* Log-message categories. FLOG is only used on the daemon side to