X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/f9df736a3e22f15307f9e304eb9069b06e94208f..c0c7984e7f6009b6ab18ad3da998a56a9c0f083d:/xattrs.diff diff --git a/xattrs.diff b/xattrs.diff index c9465e7..1fd2934 100644 --- a/xattrs.diff +++ b/xattrs.diff @@ -46,7 +46,7 @@ diff --git a/xattrs.c b/xattrs.c #define RSYNC_XAL_INITIAL 5 #define RSYNC_XAL_LIST_INITIAL 100 -@@ -239,7 +241,7 @@ static int rsync_xal_get(const char *fname, item_list *xalp) +@@ -245,7 +247,7 @@ static int rsync_xal_get(const char *fname, item_list *xalp) if (!(ptr = get_xattr_data(fname, name, &datum_len, 0))) return -1; @@ -55,7 +55,7 @@ diff --git a/xattrs.c b/xattrs.c /* For large datums, we store a flag and a checksum. */ name_offset = 1 + MAX_DIGEST_LEN; sum_init(checksum_seed); -@@ -307,7 +309,7 @@ static int find_matching_xattr(item_list *xalp) +@@ -305,7 +307,7 @@ static int find_matching_xattr(item_list *xalp) || rxas1[j].datum_len != rxas2[j].datum_len || strcmp(rxas1[j].name, rxas2[j].name)) break; @@ -64,7 +64,7 @@ diff --git a/xattrs.c b/xattrs.c if (memcmp(rxas1[j].datum + 1, rxas2[j].datum + 1, MAX_DIGEST_LEN) != 0) -@@ -344,34 +346,43 @@ int send_xattr(stat_x *sxp, int f) +@@ -342,13 +344,22 @@ int send_xattr(stat_x *sxp, int f) { int ndx = find_matching_xattr(sxp->xattr); @@ -88,37 +88,29 @@ diff --git a/xattrs.c b/xattrs.c - write_varint(f, count); + write_varint30(f, count); for (rxa = sxp->xattr->items; count--; rxa++) { - #ifdef HAVE_LINUX_XATTRS -- write_varint(f, rxa->name_len); + size_t name_len = rxa->name_len; + const char *name = rxa->name; +@@ -367,8 +378,8 @@ int send_xattr(stat_x *sxp, int f) + name_len += UPRE_LEN; + } + #endif +- write_varint(f, name_len); - write_varint(f, rxa->datum_len); -+ write_varint30(f, rxa->name_len); ++ write_varint30(f, name_len); + write_varint30(f, rxa->datum_len); - write_buf(f, rxa->name, rxa->name_len); - #else - /* We strip the rsync prefix from disguised namespaces - * and put everything else in the user namespace. */ - if (HAS_PREFIX(rxa->name, RSYNC_PREFIX) - && rxa->name[RPRE_LEN] != '%') { -- write_varint(f, rxa->name_len - RPRE_LEN); -- write_varint(f, rxa->datum_len); -+ write_varint30(f, rxa->name_len - RPRE_LEN); -+ write_varint30(f, rxa->datum_len); - write_buf(f, rxa->name + RPRE_LEN, rxa->name_len - RPRE_LEN); - } else { -- write_varint(f, rxa->name_len + UPRE_LEN); -- write_varint(f, rxa->datum_len); -+ write_varint30(f, rxa->name_len + UPRE_LEN); -+ write_varint30(f, rxa->datum_len); + #ifndef HAVE_LINUX_XATTRS + if (name_len > rxa->name_len) { write_buf(f, USER_PREFIX, UPRE_LEN); - write_buf(f, rxa->name, rxa->name_len); +@@ -376,7 +387,7 @@ int send_xattr(stat_x *sxp, int f) } #endif + write_buf(f, name, name_len); - if (rxa->datum_len > MAX_FULL_DATUM) + if (rxa->datum_len > MAX_FULL_DATUM && protocol_version >= 30) write_buf(f, rxa->datum + 1, MAX_DIGEST_LEN); else write_buf(f, rxa->datum, rxa->datum_len); -@@ -421,7 +432,7 @@ int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all) +@@ -426,7 +437,7 @@ int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all) cmp = rec_cnt ? strcmp(snd_rxa->name, rec_rxa->name) : -1; if (cmp > 0) same = 0; @@ -127,7 +119,7 @@ diff --git a/xattrs.c b/xattrs.c same = cmp == 0 && snd_rxa->datum_len == rec_rxa->datum_len && memcmp(snd_rxa->datum + 1, rec_rxa->datum + 1, MAX_DIGEST_LEN) == 0; -@@ -464,6 +475,9 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out) +@@ -469,6 +480,9 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out) int cnt, prior_req = 0; rsync_xa *rxa; @@ -137,7 +129,7 @@ diff --git a/xattrs.c b/xattrs.c lst += F_XATTR(file); for (rxa = lst->items, cnt = lst->count; cnt--; rxa++) { if (rxa->datum_len <= MAX_FULL_DATUM) -@@ -518,6 +532,9 @@ int recv_xattr_request(struct file_struct *file, int f_in) +@@ -523,6 +537,9 @@ int recv_xattr_request(struct file_struct *file, int f_in) rsync_xa *rxa; int rel_pos, cnt, num, got_xattr_data = 0; @@ -147,10 +139,10 @@ diff --git a/xattrs.c b/xattrs.c if (F_XATTR(file) < 0) { rprintf(FERROR, "recv_xattr_request: internal data error!\n"); exit_cleanup(RERR_STREAMIO); -@@ -574,7 +591,22 @@ void receive_xattr(struct file_struct *file, int f) - { - static item_list temp_xattr = EMPTY_ITEM_LIST; - int count, num; +@@ -584,7 +601,22 @@ void receive_xattr(struct file_struct *file, int f) + #else + int need_sort = 1; + #endif - int ndx = read_varint(f); + int ndx; + @@ -171,7 +163,7 @@ diff --git a/xattrs.c b/xattrs.c if (ndx < 0 || (size_t)ndx > rsync_xal_l.count) { rprintf(FERROR, "receive_xattr: xa index %d out of" -@@ -587,7 +619,7 @@ void receive_xattr(struct file_struct *file, int f) +@@ -597,7 +629,7 @@ void receive_xattr(struct file_struct *file, int f) return; } @@ -180,7 +172,7 @@ diff --git a/xattrs.c b/xattrs.c (void)EXPAND_ITEM_LIST(&temp_xattr, rsync_xa, count); temp_xattr.count = 0; } -@@ -595,9 +627,10 @@ void receive_xattr(struct file_struct *file, int f) +@@ -605,9 +637,10 @@ void receive_xattr(struct file_struct *file, int f) for (num = 1; num <= count; num++) { char *ptr, *name; rsync_xa *rxa;