X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/c58c1dc44601db434a9fdfa923d1b123dc9a0f25..9d737ecb7ad35232104913df1ee01dc5623b12d2:/rsync.h diff --git a/rsync.h b/rsync.h index 0e0ad82f..524011a8 100644 --- a/rsync.h +++ b/rsync.h @@ -456,11 +456,6 @@ enum msgcode { * where dev_t is a struct. */ -struct idev { - int64 ino; - int64 dev; -}; - struct idev_node { int64 key; void *data; @@ -510,20 +505,14 @@ struct idev_node { #define GID_NONE ((gid_t)-1) +union file_extras { + int32 num; + uint32 unum; +}; + struct file_struct { - union flist_extras { - uid_t uid; /* The user ID number */ - uid_t gid; /* The group ID number or GID_NONE */ - struct idev *idev; /* The hard-link info during matching */ - int32 num; /* A signed number */ - uint32 unum; /* An unsigned number */ - } extras[1]; - time_t modtime; /* When the item was last modified */ const char *dirname; /* The dir info inside the transfer */ - union { - const char *root; /* Sender-side dir info outside transfer */ - int32 depth; /* Receiver-side directory depth info */ - } dir; + time_t modtime; /* When the item was last modified */ uint32 len32; /* Lowest 32 bits of the file's length */ unsigned short mode; /* The item's type and permissions */ unsigned short flags; /* The FLAG_* bits for this item */ @@ -535,11 +524,12 @@ extern int preserve_uid; extern int preserve_gid; #define FILE_STRUCT_LEN (offsetof(struct file_struct, basename)) -#define EXTRA_LEN (sizeof (union flist_extras)) +#define EXTRA_LEN (sizeof (union file_extras)) +#define PTR_EXTRA_LEN ((sizeof (char *) + EXTRA_LEN - 1) / EXTRA_LEN) #define SUM_EXTRA_CNT ((MD4_SUM_LENGTH + EXTRA_LEN - 1) / EXTRA_LEN) -#define REQ_EXTRA(f,ndx) ((f)->extras - (ndx - 1)) -#define OPT_EXTRA(f,bump) ((f)->extras - flist_extra_cnt - (bump)) +#define REQ_EXTRA(f,ndx) ((union file_extras*)(f) - (ndx)) +#define OPT_EXTRA(f,bump) ((union file_extras*)(f) - flist_extra_cnt - 1 - (bump)) #define LEN64_BUMP(f) ((f)->flags & FLAG_LENGTH64 ? 1 : 0) #define HLINK_BUMP(f) (F_IS_HLINKED(f) ? 1 : 0) @@ -555,12 +545,17 @@ extern int preserve_gid; /* If there is a symlink string, it is always right after the basename */ #define F_SYMLINK(f) ((f)->basename + strlen((f)->basename) + 1) +/* The sending side always has this available: */ +#define F_ROOTDIR(f) (*(const char**)REQ_EXTRA(f, PTR_EXTRA_LEN)) + +/* The receiving side always has this available: */ +#define F_DEPTH(f) REQ_EXTRA(f, 1)->num + /* When the associated option is on, all entries will have these present: */ -#define F_UID(f) REQ_EXTRA(f, preserve_uid)->uid -#define F_GID(f) REQ_EXTRA(f, preserve_gid)->gid +#define F_UID(f) REQ_EXTRA(f, preserve_uid)->unum +#define F_GID(f) REQ_EXTRA(f, preserve_gid)->unum /* These items are per-entry optional and mutally exclusive: */ -#define F_HL_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev #define F_HL_GNUM(f) OPT_EXTRA(f, LEN64_BUMP(f))->num #define F_HL_PREV(f) OPT_EXTRA(f, LEN64_BUMP(f))->num