Skip to content

Commit 1c82a1e

Browse files
committed
A few file-data improvements.
1 parent 2d0c7ad commit 1c82a1e

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

configure.ac

+1
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ AC_CHECK_SIZEOF(int64_t)
389389
AC_CHECK_SIZEOF(off_t)
390390
AC_CHECK_SIZEOF(off64_t)
391391
AC_CHECK_SIZEOF(time_t)
392+
AC_CHECK_SIZEOF(char*)
392393

393394
AC_C_INLINE
394395

flist.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
759759
struct file_struct *first = flist->files[first_hlink_ndx - flist->ndx_start];
760760
file_length = F_LENGTH(first);
761761
modtime = first->modtime;
762-
modtime_nsec = F_MOD_NSEC(first);
762+
modtime_nsec = F_MOD_NSEC_or_0(first);
763763
mode = first->mode;
764764
if (preserve_uid)
765765
uid = F_OWNER(first);
@@ -944,7 +944,7 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
944944
#ifdef CAN_SET_NSEC
945945
if (modtime_nsec) {
946946
file->flags |= FLAG_MOD_NSEC;
947-
OPT_EXTRA(file, 0)->unum = modtime_nsec;
947+
F_MOD_NSEC(file) = modtime_nsec;
948948
}
949949
#endif
950950
file->len32 = (uint32)file_length;
@@ -955,7 +955,7 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
955955
exit_cleanup(RERR_UNSUPPORTED);
956956
#else
957957
file->flags |= FLAG_LENGTH64;
958-
OPT_EXTRA(file, NSEC_BUMP(file))->unum = (uint32)(file_length >> 32);
958+
F_HIGH_LEN(file) = (uint32)(file_length >> 32);
959959
#endif
960960
}
961961
#endif
@@ -1346,14 +1346,14 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
13461346
#ifdef ST_MTIME_NSEC
13471347
if (st.ST_MTIME_NSEC && protocol_version >= 31) {
13481348
file->flags |= FLAG_MOD_NSEC;
1349-
OPT_EXTRA(file, 0)->unum = st.ST_MTIME_NSEC;
1349+
F_MOD_NSEC(file) = st.ST_MTIME_NSEC;
13501350
}
13511351
#endif
13521352
file->len32 = (uint32)st.st_size;
13531353
#if SIZEOF_CAPITAL_OFF_T >= 8
13541354
if (st.st_size > 0xFFFFFFFFu && S_ISREG(st.st_mode)) {
13551355
file->flags |= FLAG_LENGTH64;
1356-
OPT_EXTRA(file, NSEC_BUMP(file))->unum = (uint32)(st.st_size >> 32);
1356+
F_HIGH_LEN(file) = (uint32)(st.st_size >> 32);
13571357
}
13581358
#endif
13591359
file->mode = st.st_mode;

generator.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static void do_delete_pass(void)
387387
static inline int time_diff(STRUCT_STAT *stp, struct file_struct *file)
388388
{
389389
#ifdef ST_MTIME_NSEC
390-
return cmp_time(stp->st_mtime, stp->ST_MTIME_NSEC, file->modtime, F_MOD_NSEC(file));
390+
return cmp_time(stp->st_mtime, stp->ST_MTIME_NSEC, file->modtime, F_MOD_NSEC_or_0(file));
391391
#else
392392
return cmp_time(stp->st_mtime, 0L, file->modtime, 0L);
393393
#endif
@@ -2065,7 +2065,7 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
20652065
if (need_retouch_dir_times) {
20662066
STRUCT_STAT st;
20672067
if (link_stat(fname, &st, 0) == 0 && time_diff(&st, file))
2068-
set_modtime(fname, file->modtime, F_MOD_NSEC(file), file->mode);
2068+
set_modtime(fname, file->modtime, F_MOD_NSEC_or_0(file), file->mode);
20692069
}
20702070
if (counter >= loopchk_limit) {
20712071
if (allowed_lull)

rsync.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
560560
|| (flags & ATTRS_SET_NANO && NSEC_BUMP(file) && (uint32)sxp->st.ST_MTIME_NSEC != F_MOD_NSEC(file))
561561
#endif
562562
)) {
563-
int ret = set_modtime(fname, file->modtime, F_MOD_NSEC(file), sxp->st.st_mode);
563+
int ret = set_modtime(fname, file->modtime, F_MOD_NSEC_or_0(file), sxp->st.st_mode);
564564
if (ret < 0) {
565565
rsyserr(FERROR_XFER, errno, "failed to set times on %s",
566566
full_fname(fname));

rsync.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@
5454
#define XMIT_SAME_TIME (1<<7)
5555
#define XMIT_SAME_RDEV_MAJOR (1<<8) /* protocols 28 - now (devices only) */
5656
#define XMIT_NO_CONTENT_DIR (1<<8) /* protocols 30 - now (dirs only) */
57-
#define XMIT_HLINKED (1<<9) /* protocols 28 - now */
57+
#define XMIT_HLINKED (1<<9) /* protocols 28 - now (non-dirs) */
5858
#define XMIT_SAME_DEV_pre30 (1<<10) /* protocols 28 - 29 */
5959
#define XMIT_USER_NAME_FOLLOWS (1<<10) /* protocols 30 - now */
60-
#define XMIT_RDEV_MINOR_8_pre30 (1<<11) /* protocols 28 - 29 */
60+
#define XMIT_RDEV_MINOR_8_pre30 (1<<11) /* protocols 28 - 29 */
6161
#define XMIT_GROUP_NAME_FOLLOWS (1<<11) /* protocols 30 - now */
6262
#define XMIT_HLINK_FIRST (1<<12) /* protocols 30 - now (HLINKED files only) */
6363
#define XMIT_IO_ERROR_ENDLIST (1<<12) /* protocols 31*- now (w/XMIT_EXTENDED_FLAGS) (also protocol 30 w/'f' compat flag) */
@@ -741,11 +741,12 @@ extern int xattrs_ndx;
741741
#if SIZEOF_INT64 < 8
742742
#define F_LENGTH(f) ((int64)(f)->len32)
743743
#else
744-
#define F_LENGTH(f) ((int64)(f)->len32 + ((f)->flags & FLAG_LENGTH64 \
745-
? (int64)OPT_EXTRA(f, NSEC_BUMP(f))->unum << 32 : 0))
744+
#define F_HIGH_LEN(f) (OPT_EXTRA(f, NSEC_BUMP(f))->unum)
745+
#define F_LENGTH(f) ((int64)(f)->len32 + ((f)->flags & FLAG_LENGTH64 ? (int64)F_HIGH_LEN(f) << 32 : 0))
746746
#endif
747747

748-
#define F_MOD_NSEC(f) ((f)->flags & FLAG_MOD_NSEC ? OPT_EXTRA(f, 0)->unum : 0)
748+
#define F_MOD_NSEC(f) OPT_EXTRA(f, 0)->unum
749+
#define F_MOD_NSEC_or_0(f) ((f)->flags & FLAG_MOD_NSEC ? F_MOD_NSEC(f) : 0)
749750

750751
/* If there is a symlink string, it is always right after the basename */
751752
#define F_SYMLINK(f) ((f)->basename + strlen((f)->basename) + 1)

0 commit comments

Comments
 (0)