[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sun Jan 19 13:26:34 MST 2014


The branch, master has been updated
       via  bba31dd Avoid ACL and/or xattr lookups on IS_MISSING_FILE() entries. Fixes bug 10381.
       via  31825a9 Add IS_MISSING_FILE(statbuf) macro.
       via  5dcef7c Adding IVAL64() and SIVAL64().
       via  72e0c45 Handle more x86 hosts w/o resorting to CAREFUL_ALIGNMENT.
      from  0593471 We really depend on autoconf 2.60 these days.

;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit bba31ddf122c18ec88fe26a30c5ab9844d41ace7
Author: Wayne Davison <wayned at samba.org>
Date:   Sun Jan 19 12:24:01 2014 -0800

    Avoid ACL and/or xattr lookups on IS_MISSING_FILE() entries.
    Fixes bug 10381.

commit 31825a94b3bd531bbe6cfc1203708ecec9484364
Author: Wayne Davison <wayned at samba.org>
Date:   Sun Jan 19 12:23:39 2014 -0800

    Add IS_MISSING_FILE(statbuf) macro.

commit 5dcef7c6dd2c50cc5a96dc86efcab737fd2b7433
Author: Wayne Davison <wayned at samba.org>
Date:   Sun Jan 19 12:02:38 2014 -0800

    Adding IVAL64() and SIVAL64().

commit 72e0c450782ec3a31792eea1e47c78d1efe989cd
Author: Wayne Davison <wayned at samba.org>
Date:   Sun Jan 19 11:48:14 2014 -0800

    Handle more x86 hosts w/o resorting to CAREFUL_ALIGNMENT.

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

Summary of changes:
 acls.c      |    3 ++-
 byteorder.h |   28 ++++++++++++++++++++++++++--
 flist.c     |    6 +++---
 io.c        |    6 +++---
 rsync.h     |    2 ++
 xattrs.c    |    3 ++-
 6 files changed, 38 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/acls.c b/acls.c
index 23bdf86..3f277b8 100644
--- a/acls.c
+++ b/acls.c
@@ -560,7 +560,8 @@ int get_acl(const char *fname, stat_x *sxp)
 		if (!preserve_devices)
 #endif
 			return 0;
-	}
+	} else if (IS_MISSING_FILE(sxp->st))
+		return 0;
 
 	if (get_rsync_acl(fname, sxp->acc_acl, SMB_ACL_TYPE_ACCESS,
 			  sxp->st.st_mode) < 0) {
diff --git a/byteorder.h b/byteorder.h
index 579145d..22e807a 100644
--- a/byteorder.h
+++ b/byteorder.h
@@ -23,7 +23,7 @@
 
 /* We know that the x86 can handle misalignment and has the same
  * byte order (LSB-first) as the 32-bit numbers we transmit. */
-#ifdef __i386__
+#if defined __i386__ || defined __i486__ || defined __i586__ || defined __i686__ || __amd64
 #define CAREFUL_ALIGNMENT 0
 #endif
 
@@ -38,9 +38,11 @@
 
 #define PVAL(buf,pos) (UVAL(buf,pos)|UVAL(buf,(pos)+1)<<8)
 #define IVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+2)<<16)
+#define IVAL64(buf,pos) (IVAL(buf,pos)|(int64)IVAL(buf,(pos)+4)<<32)
 #define SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8)
 #define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16))
-#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32)(val)))
+#define SIVAL(buf,pos,val) SIVALX(buf,pos,(uint32)(val))
+#define SIVAL64(buf,pos,val) (SIVAL(buf,pos,val),SIVAL(buf,(pos)+4,(val)>>32))
 
 #define IVALu(buf,pos) IVAL(buf,pos)
 #define SIVALu(buf,pos,val) SIVAL(buf,pos,val)
@@ -95,6 +97,28 @@ SIVAL(char *buf, int pos, uint32 val)
 	SIVALu((uchar*)buf, pos, val);
 }
 
+static inline int64
+IVAL64(const char *buf, int pos)
+{
+	union {
+		const char *b;
+		const int64 *num;
+	} u;
+	u.b = buf + pos;
+	return *u.num;
+}
+
+static inline void
+SIVAL64(char *buf, int pos, int64 val)
+{
+	union {
+		char *b;
+		int64 *num;
+	} u;
+	u.b = buf + pos;
+	*u.num = val;
+}
+
 # endif /* !AVOID_BYTEORDER_INLINE */
 
 #endif /* !CAREFUL_ALIGNMENT */
diff --git a/flist.c b/flist.c
index bf8d124..a346777 100644
--- a/flist.c
+++ b/flist.c
@@ -1156,7 +1156,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
 	if (sanitize_paths)
 		sanitize_path(thisname, thisname, "", 0, SP_DEFAULT);
 
-	if (stp && (S_ISDIR(stp->st_mode) || stp->st_mode == 0)) {
+	if (stp && (S_ISDIR(stp->st_mode) || IS_MISSING_FILE(*stp))) {
 		/* This is needed to handle a "symlink/." with a --relative
 		 * dir, or a request to delete a specific file. */
 		st = *stp;
@@ -1200,7 +1200,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
 				full_fname(thisname));
 		}
 		return NULL;
-	} else if (st.st_mode == 0) {
+	} else if (IS_MISSING_FILE(st)) {
 		io_error |= IOERR_GENERAL;
 		rprintf(FINFO, "skipping file with bogus (zero) st_mode: %s\n",
 			full_fname(thisname));
@@ -2290,7 +2290,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
 				} else
 					fn = p;
 				send_implied_dirs(f, flist, fbuf, fbuf, p, flags,
-						  st.st_mode == 0 ? MISSING_NAME : name_type);
+						  IS_MISSING_FILE(st) ? MISSING_NAME : name_type);
 				if (fn == p)
 					continue;
 			}
diff --git a/io.c b/io.c
index 264824e..354fc13 100644
--- a/io.c
+++ b/io.c
@@ -1785,7 +1785,7 @@ int64 read_varlong(int f, uchar min_bytes)
 #if SIZEOF_INT64 < 8
 	u.x = IVAL(u.b,0);
 #elif CAREFUL_ALIGNMENT
-	u.x = IVAL(u.b,0) | (((int64)IVAL(u.b,4))<<32);
+	u.x = IVAL64(u.b,0);
 #endif
 	return u.x;
 }
@@ -2037,10 +2037,10 @@ void write_varlong(int f, int64 x, uchar min_bytes)
 	uchar bit;
 	int cnt = 8;
 
-	SIVAL(b, 1, x);
 #if SIZEOF_INT64 >= 8
-	SIVAL(b, 5, x >> 32);
+	SIVAL64(b, 1, x);
 #else
+	SIVAL(b, 1, x);
 	if (x <= 0x7FFFFFFF && x >= 0)
 		memset(b + 5, 0, 4);
 	else {
diff --git a/rsync.h b/rsync.h
index fcb4c26..b2869d0 100644
--- a/rsync.h
+++ b/rsync.h
@@ -787,6 +787,8 @@ extern int xattrs_ndx;
 #define DIR_FIRST_CHILD(a) (a)[1]
 #define DIR_NEXT_SIBLING(a) (a)[2]
 
+#define IS_MISSING_FILE(statbuf) ((statbuf).st_mode == 0)
+
 /*
  * Start the flist array at FLIST_START entries and grow it
  * by doubling until FLIST_LINEAR then grow by FLIST_LINEAR
diff --git a/xattrs.c b/xattrs.c
index 01d30e4..7e31422 100644
--- a/xattrs.c
+++ b/xattrs.c
@@ -308,7 +308,8 @@ int get_xattr(const char *fname, stat_x *sxp)
 		if (!preserve_devices)
 #endif
 			return 0;
-	}
+	} else if (IS_MISSING_FILE(sxp->st))
+		return 0;
 
 	if (rsync_xal_get(fname, sxp->xattr) < 0) {
 		free_xattr(sxp);


-- 
The rsync repository.


More information about the rsync-cvs mailing list