Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- The XMIT_SAME_DEV define is now pre-protocol-30 specific.
[rsync/rsync.git]
/
flist.c
diff --git
a/flist.c
b/flist.c
index
f163db2
..
93c849a
100644
(file)
--- a/
flist.c
+++ b/
flist.c
@@
-58,6
+58,7
@@
extern int protocol_version;
extern int sanitize_paths;
extern struct stats stats;
extern struct file_list *the_file_list;
extern int sanitize_paths;
extern struct stats stats;
extern struct file_list *the_file_list;
+extern alloc_pool_t hlink_pool;
extern char curr_dir[MAXPATHLEN];
extern char curr_dir[MAXPATHLEN];
@@
-74,11
+75,13
@@
dev_t filesystem_dev; /* used to implement -x */
* that the sender doesn't need to remember in its file list. The data
* will survive just long enough to be used by send_file_entry(). */
static dev_t tmp_rdev;
* that the sender doesn't need to remember in its file list. The data
* will survive just long enough to be used by send_file_entry(). */
static dev_t tmp_rdev;
+#ifdef SUPPORT_HARD_LINKS
static struct idev tmp_idev;
static struct idev tmp_idev;
+#endif
static char tmp_sum[MD4_SUM_LENGTH];
static char empty_sum[MD4_SUM_LENGTH];
static char tmp_sum[MD4_SUM_LENGTH];
static char empty_sum[MD4_SUM_LENGTH];
-static int flist_count_offset;
+static int flist_count_offset;
/* for --delete --progress */
static void clean_flist(struct file_list *flist, int strip_root, int no_dups);
static void output_flist(struct file_list *flist);
static void clean_flist(struct file_list *flist, int strip_root, int no_dups);
static void output_flist(struct file_list *flist);
@@
-87,7
+90,7
@@
void init_flist(void)
{
if (verbose > 4) {
rprintf(FINFO, "FILE_STRUCT_LEN=%d, EXTRA_LEN=%d\n",
{
if (verbose > 4) {
rprintf(FINFO, "FILE_STRUCT_LEN=%d, EXTRA_LEN=%d\n",
-
FILE_STRUCT_LEN,
EXTRA_LEN);
+
(int)FILE_STRUCT_LEN, (int)
EXTRA_LEN);
}
checksum_len = protocol_version < 21 ? 2 : MD4_SUM_LENGTH;
}
}
checksum_len = protocol_version < 21 ? 2 : MD4_SUM_LENGTH;
}
@@
-384,7
+387,7
@@
static void send_file_entry(struct file_struct *file, int f)
flags |= XMIT_SAME_DEV;
} else
dev = tmp_idev.dev;
flags |= XMIT_SAME_DEV;
} else
dev = tmp_idev.dev;
- flags |= XMIT_H
AS_IDEV_DATA
;
+ flags |= XMIT_H
LINKED
;
}
#endif
}
#endif
@@
-613,11
+616,11
@@
static struct file_struct *recv_file_entry(struct file_list *flist,
linkname_len = 0;
#ifdef SUPPORT_HARD_LINKS
linkname_len = 0;
#ifdef SUPPORT_HARD_LINKS
- if (preserve_hard_links
&& protocol_version < 28 && S_ISREG(mode))
- flags |= XMIT_HAS_IDEV_DATA;
- if (flags & XMIT_HAS_IDEV_DATA) {
- extra_len += EXTRA_LEN;
-
assert(flist->hlink_pool != NULL)
;
+ if (preserve_hard_links
) {
+ if (protocol_version < 28 && S_ISREG(mode))
+ flags |= XMIT_HLINKED;
+ if (flags & XMIT_HLINKED)
+
extra_len += EXTRA_LEN
;
}
#endif
}
#endif
@@
-640,11
+643,11
@@
static struct file_struct *recv_file_entry(struct file_list *flist,
bp += basename_len + linkname_len; /* skip space for symlink too */
#ifdef SUPPORT_HARD_LINKS
bp += basename_len + linkname_len; /* skip space for symlink too */
#ifdef SUPPORT_HARD_LINKS
- if (flags & XMIT_H
AS_IDEV_DATA
)
+ if (flags & XMIT_H
LINKED
)
file->flags |= FLAG_HLINKED;
#endif
file->modtime = modtime;
file->flags |= FLAG_HLINKED;
#endif
file->modtime = modtime;
- file->len32 = file_length;
+ file->len32 =
(uint32)
file_length;
if (file_length > 0xFFFFFFFFu && S_ISREG(mode)) {
file->flags |= FLAG_LENGTH64;
OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
if (file_length > 0xFFFFFFFFu && S_ISREG(mode)) {
file->flags |= FLAG_LENGTH64;
OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
@@
-692,8
+695,9
@@
static struct file_struct *recv_file_entry(struct file_list *flist,
if ((preserve_devices && IS_DEVICE(mode))
|| (preserve_specials && IS_SPECIAL(mode))) {
if ((preserve_devices && IS_DEVICE(mode))
|| (preserve_specials && IS_SPECIAL(mode))) {
- F_DMAJOR(file) = major(rdev);
- F_DMINOR(file) = minor(rdev);
+ uint32 *devp = F_RDEV_P(file);
+ DEV_MAJOR(devp) = major(rdev);
+ DEV_MINOR(devp) = minor(rdev);
}
#ifdef SUPPORT_LINKS
}
#ifdef SUPPORT_LINKS
@@
-706,10
+710,10
@@
static struct file_struct *recv_file_entry(struct file_list *flist,
#endif
#ifdef SUPPORT_HARD_LINKS
#endif
#ifdef SUPPORT_HARD_LINKS
- if (
flags & XMIT_HAS_IDEV_DATA
) {
- struct idev *idevp = pool_talloc(
flist->
hlink_pool, struct idev,
+ if (
preserve_hard_links && flags & XMIT_HLINKED
) {
+ struct idev *idevp = pool_talloc(hlink_pool, struct idev,
1, "inode_table");
1, "inode_table");
- F_IDEV(file) = idevp;
+ F_
HL_
IDEV(file) = idevp;
if (protocol_version < 26) {
idevp->dev = read_int(f);
idevp->ino = read_int(f);
if (protocol_version < 26) {
idevp->dev = read_int(f);
idevp->ino = read_int(f);
@@
-920,7
+924,7
@@
struct file_struct *make_file(const char *fname, struct file_list *flist,
file->flags = flags;
file->modtime = st.st_mtime;
file->flags = flags;
file->modtime = st.st_mtime;
- file->len32 = st.st_size;
+ file->len32 =
(uint32)
st.st_size;
if (st.st_size > 0xFFFFFFFFu && S_ISREG(st.st_mode)) {
file->flags |= FLAG_LENGTH64;
OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32);
if (st.st_size > 0xFFFFFFFFu && S_ISREG(st.st_mode)) {
file->flags |= FLAG_LENGTH64;
OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32);
@@
-1041,8
+1045,7
@@
static void send_if_directory(int f, struct file_list *flist,
* file list in memory without sending it over the wire. Also, get_dirlist()
* might call this with f set to -2, which also indicates that local filter
* rules should be ignored. */
* file list in memory without sending it over the wire. Also, get_dirlist()
* might call this with f set to -2, which also indicates that local filter
* rules should be ignored. */
-static void send_directory(int f, struct file_list *flist,
- char *fbuf, int len)
+static void send_directory(int f, struct file_list *flist, char *fbuf, int len)
{
struct dirent *di;
unsigned remainder;
{
struct dirent *di;
unsigned remainder;
@@
-1112,7
+1115,7
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
start_write = stats.total_written;
gettimeofday(&start_tv, NULL);
start_write = stats.total_written;
gettimeofday(&start_tv, NULL);
- flist = flist_new(
0,
"send_file_list");
+ flist = flist_new("send_file_list");
io_start_buffering_out();
if (filesfrom_fd >= 0) {
io_start_buffering_out();
if (filesfrom_fd >= 0) {
@@
-1376,7
+1379,7
@@
struct file_list *recv_file_list(int f)
start_read = stats.total_read;
start_read = stats.total_read;
- flist = flist_new(
WITH_HLINK,
"recv_file_list");
+ flist = flist_new("recv_file_list");
while ((flags = read_byte(f)) != 0) {
while ((flags = read_byte(f)) != 0) {
@@
-1508,10
+1511,8
@@
void clear_file(struct file_struct *file)
file->len32 = file->dir.depth = 1;
}
file->len32 = file->dir.depth = 1;
}
-/*
- * allocate a new file list
- */
-struct file_list *flist_new(int with_hlink, char *msg)
+/* Allocate a new file list. */
+struct file_list *flist_new(char *msg)
{
struct file_list *flist;
{
struct file_list *flist;
@@
-1524,24
+1525,13
@@
struct file_list *flist_new(int with_hlink, char *msg)
if (!(flist->file_pool = pool_create(FILE_EXTENT, 0, out_of_memory, POOL_INTERN)))
out_of_memory(msg);
if (!(flist->file_pool = pool_create(FILE_EXTENT, 0, out_of_memory, POOL_INTERN)))
out_of_memory(msg);
-#ifdef SUPPORT_HARD_LINKS
- if (with_hlink && preserve_hard_links) {
- if (!(flist->hlink_pool = pool_create(HLINK_EXTENT,
- sizeof (struct idev), out_of_memory, POOL_INTERN)))
- out_of_memory(msg);
- }
-#endif
-
return flist;
}
return flist;
}
-/*
- * free up all elements in a flist
- */
+/* Free up all elements in a flist. */
void flist_free(struct file_list *flist)
{
pool_destroy(flist->file_pool);
void flist_free(struct file_list *flist)
{
pool_destroy(flist->file_pool);
- pool_destroy(flist->hlink_pool);
free(flist->files);
free(flist);
}
free(flist->files);
free(flist);
}
@@
-1923,8
+1913,7
@@
char *f_name(struct file_struct *f, char *fbuf)
* of the dirname string, and also indicates that "dirname" is a MAXPATHLEN
* buffer (the functions we call will append names onto the end, but the old
* dir value will be restored on exit). */
* of the dirname string, and also indicates that "dirname" is a MAXPATHLEN
* buffer (the functions we call will append names onto the end, but the old
* dir value will be restored on exit). */
-struct file_list *get_dirlist(char *dirname, int dlen,
- int ignore_filter_rules)
+struct file_list *get_dirlist(char *dirname, int dlen, int ignore_filter_rules)
{
struct file_list *dirlist;
char dirbuf[MAXPATHLEN];
{
struct file_list *dirlist;
char dirbuf[MAXPATHLEN];
@@
-1938,7
+1927,7
@@
struct file_list *get_dirlist(char *dirname, int dlen,
dirname = dirbuf;
}
dirname = dirbuf;
}
- dirlist = flist_new(
WITHOUT_HLINK,
"get_dirlist");
+ dirlist = flist_new("get_dirlist");
recurse = 0;
xfer_dirs = 1;
recurse = 0;
xfer_dirs = 1;