+extern int flist_extra_cnt;
+extern int preserve_uid;
+extern int preserve_gid;
+
+#define FILE_STRUCT_LEN (offsetof(struct file_struct, flags) \
+ + sizeof (unsigned short))
+#define EXTRA_LEN (sizeof (union flist_extras))
+#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 LEN64_BUMP(f) ((f)->flags & FLAG_LENGTH64 ? 1 : 0)
+#define HLINK_BUMP(f) (F_IS_HLINKED(f) ? 1 : 0)
+
+/* Basename (AKA filename) and length applies to all items */
+#define F_BASENAME(f) ((const char*)(f) + FILE_STRUCT_LEN)
+#if SIZEOF_INT64 < 8
+#define F_LENGTH(f) ((int64)(f)->len32)
+#else
+#define F_LENGTH(f) ((int64)(f)->len32 + ((f)->flags & FLAG_LENGTH64 \
+ ? (int64)OPT_EXTRA(f, 0)->unum << 32 : 0))
+#endif
+
+/* If there is a symlink string, it is always right after the basename */
+#define F_SYMLINK(f) (F_BASENAME(f) + strlen(F_BASENAME(f)) + 1)
+
+/* 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
+
+/* These items are per-entry optional and mutally exclusive: */
+#define F_HL_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
+#define F_HL_PREV(f) OPT_EXTRA(f, LEN64_BUMP(f))->num
+
+/* This optional item might follow an F_HL_*() item.
+ * (Note: a device doesn't need to check LEN64_BUMP(f).) */
+#define F_RDEV_P(f) (&OPT_EXTRA(f, HLINK_BUMP(f) + 2 - 1)->unum)
+
+/* The sum is only present on regular files. */
+#define F_SUM(f) ((const char*)OPT_EXTRA(f, LEN64_BUMP(f) + HLINK_BUMP(f) \
+ + SUM_EXTRA_CNT - 1))
+
+/* Some utility defines: */
+#define F_IS_ACTIVE(f) F_BASENAME(f)[0]
+#define F_IS_HLINKED(f) ((f)->flags & FLAG_HLINKED)
+#define F_NOT_HLINK_FIRST(f) BITS_SETnUNSET((f)->flags, FLAG_HLINKED, FLAG_HLINK_FIRST)
+#define F_NOT_HLINK_LAST(f) BITS_SETnUNSET((f)->flags, FLAG_HLINKED, FLAG_HLINK_LAST)
+
+#define DEV_MAJOR(a) (a)[0]
+#define DEV_MINOR(a) (a)[1]
+