static gid_t gid;
static const char *user_name, *group_name;
static char lastname[MAXPATHLEN];
+#ifdef SUPPORT_HARD_LINKS
int first_hlink_ndx = -1;
+#endif
int l1, l2;
int xflags;
np->data = (void*)(long)(first_ndx + ndx + 1);
xflags |= XMIT_HLINK_FIRST;
}
+ if (DEBUG_GTE(HLINK, 1)) {
+ rprintf(FINFO, "found %s dev:inode %s:%s (#%ld)\n",
+ xflags & XMIT_HLINK_FIRST ? "first" : "matching",
+ big_num(tmp_dev, 0), big_num(tmp_ino, 0),
+ (long)np->data - 1);
+ }
} else {
if (tmp_dev == dev) {
if (protocol_version >= 28)
write_byte(f, l2);
write_buf(f, fname + l1, l2);
+#ifdef SUPPORT_HARD_LINKS
if (first_hlink_ndx >= 0) {
write_varint(f, first_hlink_ndx);
- if (first_hlink_ndx >= first_ndx)
+ if (first_hlink_ndx >= first_ndx) {
+ if (DEBUG_GTE(HLINK, 2))
+ rprintf(FINFO, "sending abbr. entry\n");
goto the_end;
+ }
}
+#endif
write_varlong30(f, F_LENGTH(file), 3);
if (!(xflags & XMIT_SAME_TIME)) {
write_buf(f, sum, checksum_len);
}
+#ifdef SUPPORT_HARD_LINKS
the_end:
+#endif
strlcpy(lastname, fname, MAXPATHLEN);
if (S_ISREG(mode) || S_ISLNK(mode))
first_hlink_ndx, flist->ndx_start + flist->used);
exit_cleanup(RERR_PROTOCOL);
}
+ if (DEBUG_GTE(HLINK, 2)) {
+ rprintf(FINFO, "hard-link reference #%d (%sabbr.)\n",
+ first_hlink_ndx,
+ first_hlink_ndx >= flist->ndx_start ? "" : "un");
+ }
if (first_hlink_ndx >= flist->ndx_start) {
struct file_struct *first = flist->files[first_hlink_ndx - flist->ndx_start];
file_length = F_LENGTH(first);
tbl->size = size;
tbl->entries = 0;
tbl->node_size = node_size;
- tbl->key64 = key64;
+ tbl->key64 = (short)key64;
return tbl;
}
if (!dev_node || dev_node->key != dev) {
/* We keep a separate hash table of inodes for every device. */
dev_node = hashtable_find(dev_tbl, dev, 1);
- if (!(tbl = dev_node->data))
+ if (!(tbl = dev_node->data)) {
tbl = dev_node->data = hashtable_create(512, SIZEOF_INT64 == 8);
+ if (DEBUG_GTE(HLINK, 1)) {
+ rprintf(FINFO,
+ "created inode hashtable for dev %s\n",
+ big_num(dev, 0));
+ }
+ }
} else
tbl = dev_node->data;
void *nodes;
int32 size, entries;
uint32 node_size;
- int key64;
+ short key64;
};
struct ht_int32_node {
cp "$name2" "$name4" || fail "Can't copy file"
cat $srcdir/*.c >"$fromdir/text"
-checkit "$RSYNC -aHivv '$fromdir/' '$todir/'" "$fromdir" "$todir"
+checkit "$RSYNC -aHivv --debug=hlink5 '$fromdir/' '$todir/'" "$fromdir" "$todir"
echo "extra extra" >>"$todir/name1"
-checkit "$RSYNC -aHivv --no-whole-file '$fromdir/' '$todir/'" "$fromdir" "$todir"
+checkit "$RSYNC -aHivv --debug=hlink5 --no-whole-file '$fromdir/' '$todir/'" "$fromdir" "$todir"
# Add a new link in a new subdirectory to test that we don't try to link
# the files before the directory gets created. We also create a bunch of
ln "$name1" "$fromdir/subdir/down/deep/new-file"
rm "$todir/text"
-checkit "$RSYNC -aHivve '$SSH' --rsync-path='$RSYNC' '$fromdir/' localhost:'$todir/'" "$fromdir" "$todir"
+checkit "$RSYNC -aHivve '$SSH' --debug=hlink5 --rsync-path='$RSYNC' '$fromdir/' localhost:'$todir/'" "$fromdir" "$todir"
# Do some duplicate copies using --link-dest and --copy-dest to test that
# we hard-link all locally-inherited items.
-checkit "$RSYNC -aHivv --link-dest='$todir' '$fromdir/' '$chkdir/'" "$todir" "$chkdir"
+checkit "$RSYNC -aHivv --debug=hlink5 --link-dest='$todir' '$fromdir/' '$chkdir/'" "$todir" "$chkdir"
rm -rf "$chkdir"
-checkit "$RSYNC -aHivv --copy-dest='$todir' '$fromdir/' '$chkdir/'" "$fromdir" "$chkdir"
+checkit "$RSYNC -aHivv --debug=hlink5 --copy-dest='$todir' '$fromdir/' '$chkdir/'" "$fromdir" "$chkdir"
# Create a hard link that has only one part in the hierarchy.
echo "This is another file" >"$fromdir/solo"
ln "$fromdir/solo" "$chkdir/solo" || fail "Can't create hardlink"
# Make sure that the checksum data doesn't slide due to an HLINK_BUMP() change.
-$RSYNC -aHivc "$fromdir/" "$chkdir/" | tee "$outfile"
+$RSYNC -aHivc --debug=hlink5 "$fromdir/" "$chkdir/" | tee "$outfile"
grep solo "$outfile" && test_fail "Erroneous copy of solo file occurred!"
# Make sure there's nothing wrong with sending a single file with -H
# enabled (this has broken twice so far, so we need this test).
rm -rf "$todir"
-$RSYNC -aHivv "$name1" "$todir/"
+$RSYNC -aHivv --debug=hlink5 "$name1" "$todir/"
diff $diffopt "$name1" "$todir" || test_fail "solo copy of name1 failed"
# The script would have aborted on error, so getting here means we've won.