[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Mon Nov 25 14:13:48 MST 2013


The branch, master has been updated
       via  836e0c5 Create and use write_bigbuf() function for extra-large buffer sizes.
       via  2cd8708 Use chunked xattr reading in OS X sys_lgetxattr().
      from  eaa4e2d Fix itemize bug with --link-dest, -X, and -n.

;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 836e0c5df418a9fd0744e9101f05245322f8668a
Author: Wayne Davison <wayned at samba.org>
Date:   Mon Nov 25 13:12:35 2013 -0800

    Create and use write_bigbuf() function for extra-large buffer sizes.

commit 2cd87086f05d0a6d943e8fa71f7f6b53b5375d56
Author: Wayne Davison <wayned at samba.org>
Date:   Mon Nov 25 13:12:09 2013 -0800

    Use chunked xattr reading in OS X sys_lgetxattr().

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

Summary of changes:
 io.c            |   13 +++++++++++++
 lib/sysxattrs.c |   23 ++++++++++++++++++++++-
 xattrs.c        |    4 ++--
 3 files changed, 37 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/io.c b/io.c
index c5b1ebc..264824e 100644
--- a/io.c
+++ b/io.c
@@ -2087,6 +2087,19 @@ void write_longint(int f, int64 x)
 #endif
 }
 
+void write_bigbuf(int f, const char *buf, size_t len)
+{
+	size_t half_max = (iobuf.out.size - iobuf.out_empty_len) / 2;
+
+	while (len > half_max + 1024) {
+		write_buf(f, buf, half_max);
+		buf += half_max;
+		len -= half_max;
+	}
+
+	write_buf(f, buf, len);
+}
+
 void write_buf(int f, const char *buf, size_t len)
 {
 	size_t pos, siz;
diff --git a/lib/sysxattrs.c b/lib/sysxattrs.c
index d55ee0c..ba1a290 100644
--- a/lib/sysxattrs.c
+++ b/lib/sysxattrs.c
@@ -24,6 +24,10 @@
 
 #ifdef SUPPORT_XATTRS
 
+#ifdef HAVE_OSX_XATTRS
+#define GETXATTR_FETCH_LIMIT (64*1024*1024)
+#endif
+
 #if defined HAVE_LINUX_XATTRS
 
 ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t size)
@@ -55,7 +59,24 @@ ssize_t sys_llistxattr(const char *path, char *list, size_t size)
 
 ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t size)
 {
-	return getxattr(path, name, value, size, 0, XATTR_NOFOLLOW);
+	ssize_t len = getxattr(path, name, value, size, 0, XATTR_NOFOLLOW);
+
+	/* If we're retrieving data, handle resource forks > 64MB specially */
+	if (value != NULL && len == GETXATTR_FETCH_LIMIT && (size_t)len < size) {
+		/* getxattr will only return 64MB of data at a time, need to call again with a new offset */
+		u_int32_t offset = len;
+		size_t data_retrieved = len;
+		while (data_retrieved < size) {
+			len = getxattr(path, name, value + offset, size - data_retrieved, offset, XATTR_NOFOLLOW);
+			if (len <= 0)
+				break;
+			data_retrieved += len;
+			offset += (u_int32_t)len;
+		}
+		len = data_retrieved;
+	}
+
+	return len;
 }
 
 ssize_t sys_fgetxattr(int filedes, const char *name, void *value, size_t size)
diff --git a/xattrs.c b/xattrs.c
index df2ea82..01d30e4 100644
--- a/xattrs.c
+++ b/xattrs.c
@@ -451,7 +451,7 @@ int send_xattr(int f, stat_x *sxp)
 			if (rxa->datum_len > MAX_FULL_DATUM)
 				write_buf(f, rxa->datum + 1, MAX_DIGEST_LEN);
 			else
-				write_buf(f, rxa->datum, rxa->datum_len);
+				write_bigbuf(f, rxa->datum, rxa->datum_len);
 		}
 		ndx = rsync_xal_l.count; /* pre-incremented count */
 		rsync_xal_store(sxp->xattr); /* adds item to rsync_xal_l */
@@ -579,7 +579,7 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
 			}
 
 			write_varint(f_out, len); /* length might have changed! */
-			write_buf(f_out, ptr, len);
+			write_bigbuf(f_out, ptr, len);
 			free(ptr);
 		}
 	}


-- 
The rsync repository.


More information about the rsync-cvs mailing list