[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Mon May 25 01:45:07 UTC 2020


The branch, master has been updated
       via  4496e0e8 A few more compression tweaks.
      from  64d5ea39 More compress changes

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4496e0e8e7a7616ef64b683edc7a249ee16b5a1b
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sun May 24 18:08:09 2020 -0700

    A few more compression tweaks.

-----------------------------------------------------------------------

Summary of changes:
 compat.c     | 17 ++++-------------
 configure.ac |  2 +-
 flist.c      |  2 +-
 options.c    | 10 +++++-----
 rsync.h      |  4 ++++
 token.c      | 11 +++++------
 6 files changed, 20 insertions(+), 26 deletions(-)


Changeset truncated at 500 lines:

diff --git a/compat.c b/compat.c
index 3a5ad46d..20dc85fd 100644
--- a/compat.c
+++ b/compat.c
@@ -87,10 +87,6 @@ int filesfrom_convert = 0;
 
 #define MAX_NSTR_STRLEN 256
 
-#define CPRES_NONE 0
-#define CPRES_ZLIB 1
-#define CPRES_ZLIBX 2
-
 struct name_num_obj valid_compressions = {
 	"compress", NULL, NULL, 0, 0, {
 #ifndef EXTERNAL_ZLIB
@@ -169,25 +165,20 @@ void set_allow_inc_recurse(void)
 
 void parse_compress_choice(int final_call)
 {
-	int num;
-
 	if (valid_compressions.negotiated_name)
-		num = valid_compressions.negotiated_num;
+		do_compression = valid_compressions.negotiated_num;
 	else if (compress_choice) {
 		struct name_num_item *nni = get_nni_by_name(&valid_compressions, compress_choice, -1);
 		if (!nni) {
 			rprintf(FERROR, "unknown compress name: %s\n", compress_choice);
 			exit_cleanup(RERR_UNSUPPORTED);
 		}
-		num = nni->num;
+		do_compression = nni->num;
 	} else
-		num = CPRES_NONE;
+		do_compression = CPRES_NONE;
 
-	if (num == CPRES_NONE) {
-		do_compression = 0;
+	if (do_compression == CPRES_NONE)
 		compress_choice = NULL;
-	} else if (num > 0)
-		do_compression = num != CPRES_ZLIB ? 2 : 1;
 
 	if (final_call && DEBUG_GTE(NSTR, am_server ? 2 : 1)) {
 		const char *c_s = am_server ? "Server" : "Client";
diff --git a/configure.ac b/configure.ac
index 427959f3..e22e17e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -397,7 +397,7 @@ else
     AC_MSG_RESULT(no)
 fi
 
-AC_MSG_CHECKING([whether to enable the xxhash support])
+AC_MSG_CHECKING([whether to enable xxhash checksum support])
 AC_ARG_ENABLE([xxhash],
 	AS_HELP_STRING([--disable-xxhash],[disable xxhash checksums]))
 AH_TEMPLATE([SUPPORT_XXHASH],
diff --git a/flist.c b/flist.c
index a1b3e4bb..7e08fd40 100644
--- a/flist.c
+++ b/flist.c
@@ -142,7 +142,7 @@ void init_flist(void)
 		rprintf(FINFO, "FILE_STRUCT_LEN=%d, EXTRA_LEN=%d\n",
 			(int)FILE_STRUCT_LEN, (int)EXTRA_LEN);
 	}
-	parse_checksum_choice(1); /* Sets checksum_type && xfersum_type */
+	parse_checksum_choice(1); /* Sets checksum_type & xfersum_type */
 	parse_compress_choice(1); /* Sets do_compression */
 	flist_csum_len = csum_len_for_type(checksum_type, 1);
 
diff --git a/options.c b/options.c
index 469b9fb6..ff8c390e 100644
--- a/options.c
+++ b/options.c
@@ -1968,7 +1968,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
 	if (!compress_choice && do_compression > 1)
 		compress_choice = "zlibx";
 	if (compress_choice && strcasecmp(compress_choice, "auto") != 0)
-		parse_compress_choice(0); /* Can twiddle do_compression and possibly NULL-out compress_choice  */
+		parse_compress_choice(0); /* Twiddles do_compression and can possibly NULL-out compress_choice. */
 	else
 		compress_choice = NULL;
 
@@ -1983,7 +1983,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
 			do_compression = 0;
 			compress_choice = NULL;
 		} else if (!do_compression)
-			do_compression = 1;
+			do_compression = CPRES_ZLIB;
 		if (do_compression && refused_compress) {
 			create_refuse_error(refused_compress);
 			return 0;
@@ -2628,7 +2628,7 @@ void server_options(char **args, int *argc_p)
 	}
 	if (sparse_files)
 		argstr[x++] = 'S';
-	if (do_compression == 1)
+	if (do_compression == CPRES_ZLIB)
 		argstr[x++] = 'z';
 
 	set_allow_inc_recurse();
@@ -2765,9 +2765,9 @@ void server_options(char **args, int *argc_p)
 		args[ac++] = arg;
 	}
 
-	if ((!compress_choice && do_compression > 1) || (compress_choice && strcasecmp(compress_choice, "zlibx") == 0))
+	if (do_compression == CPRES_ZLIBX)
 		args[ac++] = "--new-compress";
-	else if (compress_choice && strcasecmp(compress_choice, "zlib") == 0)
+	else if (compress_choice && do_compression == CPRES_ZLIB)
 		args[ac++] = "--old-compress";
 	else if (compress_choice) {
 		if (asprintf(&arg, "--compress-choice=%s", compress_choice) < 0)
diff --git a/rsync.h b/rsync.h
index 5cf75fa7..cffd0d8e 100644
--- a/rsync.h
+++ b/rsync.h
@@ -1061,6 +1061,10 @@ typedef struct {
 #define ACL_READY(sx) ((sx).acc_acl != NULL)
 #define XATTR_READY(sx) ((sx).xattr != NULL)
 
+#define CPRES_NONE 0
+#define CPRES_ZLIB 1
+#define CPRES_ZLIBX 2
+
 struct name_num_item {
 	int num;
 	const char *name, *main_name;
diff --git a/token.c b/token.c
index 1fdfa425..c1de27f0 100644
--- a/token.c
+++ b/token.c
@@ -300,8 +300,8 @@ static void
 send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
 		    int32 nb, int32 toklen)
 {
-	int32 n, r;
 	static int init_done, flush_pending;
+	int32 n, r;
 
 	if (last_token == -1) {
 		/* initialization */
@@ -406,7 +406,7 @@ send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
 	if (token == -1) {
 		/* end of file - clean up */
 		write_byte(f, END_FLAG);
-	} else if (token != -2 && do_compression == 1) {
+	} else if (token != -2 && do_compression == CPRES_ZLIB) {
 		/* Add the data in the current block to the compressor's
 		 * history and hash table. */
 		do {
@@ -640,11 +640,10 @@ int32 recv_token(int f, char **data)
 {
 	int tok;
 
-	if (!do_compression) {
+	if (!do_compression)
 		tok = simple_recv_token(f,data);
-	} else {
+	else /* CPRES_ZLIB & CPRES_ZLIBX */
 		tok = recv_deflated_token(f, data);
-	}
 	return tok;
 }
 
@@ -653,6 +652,6 @@ int32 recv_token(int f, char **data)
  */
 void see_token(char *data, int32 toklen)
 {
-	if (do_compression == 1)
+	if (do_compression == CPRES_ZLIB)
 		see_deflate_token(data, toklen);
 }


-- 
The rsync repository.



More information about the rsync-cvs mailing list