---- old/configure.in
-+++ new/configure.in
-@@ -891,6 +891,46 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_
- esac
- fi
-
-+AC_CHECK_HEADERS(attr/xattr.h)
-+AC_CHECK_HEADERS(sys/xattr.h)
-+AC_CHECK_HEADERS(sys/extattr.h)
-+
-+#################################################
-+# check for extended attribute support
-+AC_MSG_CHECKING(whether to support extended attributes)
-+AC_ARG_ENABLE(xattr-support,
-+ AC_HELP_STRING([--disable-xattr-support],
-+ [Turn off extended attribute support]))
-+
-+if test x"$enable_xattr_support" = x"no"; then
-+ AC_MSG_RESULT(no)
-+else
-+ case "$host_os" in
-+ *linux*)
-+ AC_MSG_RESULT(Using Linux xattrs)
-+ AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs])
-+ AC_DEFINE(SUPPORT_XATTRS, 1, [Define to 1 to add support for extended attributes])
-+ ;;
-+ darwin*)
-+ AC_MSG_RESULT(Using OS X xattrs)
-+ AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
-+ AC_DEFINE(SUPPORT_XATTRS, 1)
-+ ;;
-+ freebsd*)
-+ AC_MSG_RESULT(Using FreeBSD extattrs)
-+ AC_DEFINE(HAVE_FREEBSD_XATTRS, 1, [True if you have FreeBSD xattrs])
-+ AC_DEFINE(SUPPORT_XATTRS, 1)
-+ ;;
-+ *)
-+ if test x"$enable_xattr_support" = x"yes"; then
-+ AC_MSG_ERROR(Failed to find extended attribute support)
-+ else
-+ AC_MSG_RESULT(No extended attribute support found)
-+ fi
-+ ;;
-+ esac
-+fi
-+
- AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
- AC_OUTPUT
-
---- old/flist.c
-+++ new/flist.c
-@@ -43,6 +43,7 @@ extern int one_file_system;
- extern int copy_dirlinks;
- extern int keep_dirlinks;
- extern int preserve_acls;
-+extern int preserve_xattrs;
- extern int preserve_links;
- extern int preserve_hard_links;
- extern int preserve_devices;
-@@ -888,6 +889,10 @@ static struct file_struct *recv_file_ent
- if (preserve_acls && !S_ISLNK(mode))
- receive_acl(file, f);
- #endif
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs)
-+ receive_xattr(file, f );
-+#endif
-
- if (S_ISREG(mode) || S_ISLNK(mode))
- stats.total_size += file_length;
-@@ -1160,7 +1165,7 @@ static struct file_struct *send_file_nam
- int flags, int filter_flags)
- {
- struct file_struct *file;
--#ifdef SUPPORT_ACLS
-+#if defined SUPPORT_ACLS || defined SUPPORT_XATTRS
- statx sx;
- #endif
-
-@@ -1179,6 +1184,13 @@ static struct file_struct *send_file_nam
- return NULL;
- }
- #endif
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs && f >= 0) {
-+ sx.xattr = NULL;
-+ if (get_xattr(fname, &sx) < 0)
-+ return NULL;
-+ }
-+#endif
-
- maybe_emit_filelist_progress(flist->count + flist_count_offset);
-
-@@ -1192,6 +1204,12 @@ static struct file_struct *send_file_nam
- free_acl(&sx);
- }
- #endif
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs) {
-+ F_XATTR(file) = send_xattr(&sx, f);
-+ free_xattr(&sx);
-+ }
-+#endif
- }
- return file;
- }
---- old/generator.c
-+++ new/generator.c
-@@ -36,6 +36,7 @@ extern int relative_paths;
- extern int implied_dirs;
- extern int keep_dirlinks;
- extern int preserve_acls;
-+extern int preserve_xattrs;
- extern int preserve_links;
- extern int preserve_devices;
- extern int preserve_specials;
-@@ -532,6 +533,14 @@ int unchanged_attrs(const char *fname, s
- return 0;
- }
- #endif
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs) {
-+ if (!XATTR_READY(*sxp))
-+ get_xattr(fname, sxp);
-+ if (xattr_diff(file, sxp, 0))
-+ return 0;
-+ }
-+#endif
-
- return 1;
- }
-@@ -567,11 +576,19 @@ void itemize(const char *fname, struct f
- iflags |= ITEM_REPORT_ACL;
- }
- #endif
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs) {
-+ if (!XATTR_READY(*sxp))
-+ get_xattr(fname, sxp);
-+ if (xattr_diff(file, sxp, 1))
-+ iflags |= ITEM_REPORT_XATTR;
-+ }
-+#endif
- } else
- iflags |= ITEM_IS_NEW;
-
- iflags &= 0xffff;
-- if ((iflags & SIGNIFICANT_ITEM_FLAGS || verbose > 1
-+ if ((iflags & (SIGNIFICANT_ITEM_FLAGS|ITEM_REPORT_XATTR) || verbose > 1
- || stdout_format_has_i > 1 || (xname && *xname)) && !read_batch) {
- if (protocol_version >= 29) {
- if (ndx >= 0)
-@@ -581,6 +598,10 @@ void itemize(const char *fname, struct f
- write_byte(sock_f_out, fnamecmp_type);
- if (iflags & ITEM_XNAME_FOLLOWS)
- write_vstring(sock_f_out, xname, strlen(xname));
-+#ifdef SUPPORT_XATTRS
-+ if (iflags & ITEM_REPORT_XATTR && !dry_run)
-+ send_xattr_request(NULL, file, sock_f_out);
-+#endif
- } else if (ndx >= 0) {
- enum logcode code = logfile_format_has_i ? FINFO : FCLIENT;
- log_item(code, file, &stats, iflags, xname);
-@@ -1112,6 +1133,9 @@ static void recv_generator(char *fname,
- #ifdef SUPPORT_ACLS
- sx.acc_acl = sx.def_acl = NULL;
- #endif
-+#ifdef SUPPORT_XATTRS
-+ sx.xattr = NULL;
-+#endif
- if (dry_run > 1) {
- if (fuzzy_dirlist) {
- flist_free(fuzzy_dirlist);
-@@ -1636,6 +1660,10 @@ static void recv_generator(char *fname,
- if (preserve_acls)
- free_acl(&real_sx);
- #endif
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs)
-+ free_xattr(&real_sx);
-+#endif
- }
-
- if (!do_xfers) {
-@@ -1672,6 +1700,10 @@ static void recv_generator(char *fname,
- if (preserve_acls)
- free_acl(&sx);
- #endif
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs)
-+ free_xattr(&sx);
-+#endif
- return;
- }
-
---- old/lib/sysxattrs.c
-+++ new/lib/sysxattrs.c
-@@ -0,0 +1,135 @@
-+/*
-+ * Extended attribute support for rsync.
-+ *
-+ * Copyright (C) 2004 Red Hat, Inc.
-+ * Written by Jay Fenlason.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along
-+ * with this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include "rsync.h"
-+#include "sysxattrs.h"
-+
-+#ifdef SUPPORT_XATTRS
-+
-+#if defined HAVE_LINUX_XATTRS
-+
-+ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t size)
-+{
-+ return lgetxattr(path, name, value, size);
-+}
-+
-+ssize_t sys_fgetxattr(int filedes, const char *name, void *value, size_t size)
-+{
-+ return fgetxattr(filedes, name, value, size);
-+}
-+
-+int sys_lsetxattr(const char *path, const char *name, const void *value, size_t size)
-+{
-+ return lsetxattr(path, name, value, size, 0);
-+}
-+
-+int sys_lremovexattr(const char *path, const char *name)
-+{
-+ return lremovexattr(path, name);
-+}
-+
-+ssize_t sys_llistxattr(const char *path, char *list, size_t size)
-+{
-+ return llistxattr(path, list, size);
-+}
-+
-+#elif HAVE_OSX_XATTRS
-+
-+ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t size)
-+{
-+ return getxattr(path, name, value, size, 0, XATTR_NOFOLLOW);
-+}
-+
-+ssize_t sys_fgetxattr(int filedes, const char *name, void *value, size_t size)
-+{
-+ return fgetxattr(filedes, name, value, size, 0, 0);
-+}
-+
-+int sys_lsetxattr(const char *path, const char *name, const void *value, size_t size)
-+{
-+ return setxattr(path, name, value, size, 0, XATTR_NOFOLLOW);
-+}
-+
-+int sys_lremovexattr(const char *path, const char *name)
-+{
-+ return removexattr(path, name, XATTR_NOFOLLOW);
-+}
-+
-+ssize_t sys_llistxattr(const char *path, char *list, size_t size)
-+{
-+ return listxattr(path, list, size, XATTR_NOFOLLOW);
-+}
-+
-+#elif HAVE_FREEBSD_XATTRS
-+
-+ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t size)
-+{
-+ return extattr_get_link(path, EXTATTR_NAMESPACE_USER, name, value, size);
-+}
-+
-+ssize_t sys_fgetxattr(int filedes, const char *name, void *value, size_t size)
-+{
-+ return extattr_get_fd(filedes, EXTATTR_NAMESPACE_USER, name, value, size);
-+}
-+
-+int sys_lsetxattr(const char *path, const char *name, const void *value, size_t size)
-+{
-+ return extattr_set_link(path, EXTATTR_NAMESPACE_USER, name, value, size);
-+}
-+
-+int sys_lremovexattr(const char *path, const char *name)
-+{
-+ return extattr_delete_link(path, EXTATTR_NAMESPACE_USER, name);
-+}
-+
-+ssize_t sys_llistxattr(const char *path, char *list, size_t size)
-+{
-+ unsigned char keylen;
-+ ssize_t off, len = extattr_list_link(path, EXTATTR_NAMESPACE_USER, list, size);
-+
-+ if (len <= 0 || (size_t)len > size)
-+ return len;
-+
-+ /* FreeBSD puts a single-byte length before each string, with no '\0'
-+ * terminator. We need to change this into a series of null-terminted
-+ * strings. Since the size is the same, we can simply transform the
-+ * output in place. */
-+ for (off = 0; off < len; off += keylen + 1) {
-+ keylen = ((unsigned char*)list)[off];
-+ if (off + keylen >= len) {
-+ /* Should be impossible, but kernel bugs happen! */
-+ errno = EINVAL;
-+ return -1;
-+ }
-+ memmove(list+off, list+off+1, keylen);
-+ list[off+keylen] = '\0';
-+ }
-+
-+ return len;
-+}
-+
-+#else
-+
-+#error You need to create xattr compatibility functions.
-+
-+#endif
-+
-+#endif /* SUPPORT_XATTRS */
---- old/lib/sysxattrs.h
-+++ new/lib/sysxattrs.h
-@@ -0,0 +1,26 @@
-+#ifdef SUPPORT_XATTRS
-+
-+#if defined HAVE_ATTR_XATTR_H
-+#include <attr/xattr.h>
-+#elif defined HAVE_SYS_XATTR_H
-+#include <sys/xattr.h>
-+#elif defined HAVE_SYS_EXTATTR_H
-+#include <sys/extattr.h>
-+#endif
-+
-+/* Linux 2.4 does not define this as a distinct errno value: */
-+#ifndef ENOATTR
-+#define ENOATTR ENODATA
-+#endif
-+
-+ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t size);
-+ssize_t sys_fgetxattr(int filedes, const char *name, void *value, size_t size);
-+int sys_lsetxattr(const char *path, const char *name, const void *value, size_t size);
-+int sys_lremovexattr(const char *path, const char *name);
-+ssize_t sys_llistxattr(const char *path, char *list, size_t size);
-+
-+#else
-+
-+/* No xattrs available */
-+
-+#endif
---- old/main.c
-+++ new/main.c
-@@ -608,7 +608,7 @@ static void fix_basis_dirs(void)
- }
-
- /* This is only called by the sender. */
--static void read_final_goodbye(int f_in, int f_out)
-+static void read_final_goodbye(int f_in)
- {
- int i, iflags, xlen;
- uchar fnamecmp_type;
-@@ -617,8 +617,8 @@ static void read_final_goodbye(int f_in,
- if (protocol_version < 29)
- i = read_int(f_in);
- else {
-- i = read_ndx_and_attrs(f_in, f_out, &iflags,
-- &fnamecmp_type, xname, &xlen);
-+ i = read_ndx_and_attrs(f_in, &iflags, &fnamecmp_type,
-+ xname, &xlen);
- }
-
- if (i != NDX_DONE) {
-@@ -677,7 +677,7 @@ static void do_server_sender(int f_in, i
- io_flush(FULL_FLUSH);
- handle_stats(f_out);
- if (protocol_version >= 24)
-- read_final_goodbye(f_in, f_out);
-+ read_final_goodbye(f_in);
- io_flush(FULL_FLUSH);
- exit_cleanup(0);
- }
-@@ -740,7 +740,7 @@ static int do_recv(int f_in, int f_out,
- kluge_around_eof = -1;
-
- /* This should only get stopped via a USR2 signal. */
-- read_ndx_and_attrs(f_in, -1, &iflags, &fnamecmp_type,
-+ read_ndx_and_attrs(f_in, &iflags, &fnamecmp_type,
- xname, &xlen);
-
- rprintf(FERROR, "Invalid packet at end of run [%s]\n",
-@@ -977,7 +977,7 @@ int client_run(int f_in, int f_out, pid_
- io_flush(FULL_FLUSH);
- handle_stats(-1);
- if (protocol_version >= 24)
-- read_final_goodbye(f_in, f_out);
-+ read_final_goodbye(f_in);
- if (pid != -1) {
- if (verbose > 3)
- rprintf(FINFO,"client_run waiting on %d\n", (int) pid);
---- old/options.c
-+++ new/options.c
-@@ -47,6 +47,7 @@ int copy_links = 0;
- int preserve_links = 0;
- int preserve_hard_links = 0;
- int preserve_acls = 0;
-+int preserve_xattrs = 0;
- int preserve_perms = 0;
- int preserve_executability = 0;
- int preserve_devices = 0;
-@@ -201,6 +202,7 @@ static void print_rsync_version(enum log
- char const *have_inplace = "no ";
- char const *hardlinks = "no ";
- char const *acls = "no ";
-+ char const *xattrs = "no ";
- char const *links = "no ";
- char const *ipv6 = "no ";
- STRUCT_STAT *dumstat;
-@@ -220,7 +222,9 @@ static void print_rsync_version(enum log
- #ifdef SUPPORT_ACLS
- acls = "";
- #endif
--
-+#ifdef SUPPORT_XATTRS
-+ xattrs = "";
-+#endif
- #ifdef SUPPORT_LINKS
- links = "";
- #endif
-@@ -239,8 +243,8 @@ static void print_rsync_version(enum log
- (int)(sizeof (int64) * 8));
- rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
- got_socketpair, hardlinks, links, ipv6, have_inplace);
-- rprintf(f, " %sappend, %sACLs\n",
-- have_inplace, acls);
-+ rprintf(f, " %sappend, %sACLs, %sxattrs\n",
-+ have_inplace, acls, xattrs);
-
- #ifdef MAINTAINER_MODE
- rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -286,7 +290,7 @@ void usage(enum logcode F)
- rprintf(F," -q, --quiet suppress non-error messages\n");
- rprintf(F," --no-motd suppress daemon-mode MOTD (see manpage caveat)\n");
- rprintf(F," -c, --checksum skip based on checksum, not mod-time & size\n");
-- rprintf(F," -a, --archive archive mode; same as -rlptgoD (no -H, -A)\n");
-+ rprintf(F," -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)\n");
- rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
- rprintf(F," -r, --recursive recurse into directories\n");
- rprintf(F," -R, --relative use relative path names\n");
-@@ -311,6 +315,9 @@ void usage(enum logcode F)
- #ifdef SUPPORT_ACLS
- rprintf(F," -A, --acls preserve ACLs (implies --perms)\n");
- #endif
-+#ifdef SUPPORT_XATTRS
-+ rprintf(F," -X, --xattrs preserve extended attributes (implies --perms)\n");
-+#endif
- rprintf(F," -o, --owner preserve owner (super-user only)\n");
- rprintf(F," -g, --group preserve group\n");
- rprintf(F," --devices preserve device files (super-user only)\n");
-@@ -438,6 +445,9 @@ static struct poptOption long_options[]
- {"acls", 'A', POPT_ARG_NONE, 0, 'A', 0, 0 },
- {"no-acls", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 },
- {"no-A", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 },
-+ {"xattrs", 'X', POPT_ARG_NONE, 0, 'X', 0, 0 },
-+ {"no-xattrs", 0, POPT_ARG_VAL, &preserve_xattrs, 0, 0, 0 },
-+ {"no-X", 0, POPT_ARG_VAL, &preserve_xattrs, 0, 0, 0 },
- {"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
- {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
- {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
-@@ -1126,6 +1136,17 @@ int parse_arguments(int *argc, const cha
- return 0;
- #endif
-
-+ case 'X':
-+#ifdef SUPPORT_XATTRS
-+ preserve_xattrs = 1;
-+ preserve_perms = 1;
-+ break;
-+#else
-+ snprintf(err_buf,sizeof(err_buf),
-+ "extended attributes are not supported on this %s\n",
-+ am_server ? "server" : "client");
-+ return 0;
-+#endif
-
- default:
- /* A large opt value means that set_refuse_options()
-@@ -1590,6 +1611,10 @@ void server_options(char **args,int *arg
- if (preserve_acls)
- argstr[x++] = 'A';
- #endif
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs)
-+ argstr[x++] = 'X';
-+#endif
- if (recurse)
- argstr[x++] = 'r';
- if (always_checksum)
---- old/receiver.c
-+++ new/receiver.c
-@@ -22,6 +22,7 @@
- #include "rsync.h"
-
- extern int verbose;
-+extern int dry_run;
- extern int do_xfers;
- extern int am_server;
- extern int do_progress;
-@@ -366,8 +367,8 @@ int recv_files(int f_in, char *local_nam
- cleanup_disable();
-
- /* This call also sets cur_flist. */
-- ndx = read_ndx_and_attrs(f_in, -1, &iflags,
-- &fnamecmp_type, xname, &xlen);
-+ ndx = read_ndx_and_attrs(f_in, &iflags, &fnamecmp_type,
-+ xname, &xlen);
- if (ndx == NDX_DONE) {
- if (inc_recurse && first_flist) {
- flist_free(first_flist);
-@@ -397,8 +398,17 @@ int recv_files(int f_in, char *local_nam
- if (verbose > 2)
- rprintf(FINFO, "recv_files(%s)\n", fname);
-
-+#ifdef SUPPORT_XATTRS
-+ if (iflags & ITEM_REPORT_XATTR && !dry_run)
-+ recv_xattr_request(file, f_in);
-+#endif
-+
- if (!(iflags & ITEM_TRANSFER)) {
- maybe_log_item(file, iflags, itemizing, xname);
-+#ifdef SUPPORT_XATTRS
-+ if (iflags & ITEM_REPORT_XATTR && !dry_run)
-+ set_file_attrs(fname, file, NULL, 0);
-+#endif
- continue;
- }
- if (phase == 2) {
---- old/rsync.c
-+++ new/rsync.c
-@@ -32,6 +32,7 @@
- extern int verbose;
- extern int dry_run;
- extern int preserve_acls;
-+extern int preserve_xattrs;
- extern int preserve_perms;
- extern int preserve_executability;
- extern int preserve_times;
-@@ -91,10 +92,8 @@ void setup_iconv()
- }
- #endif
-
--/* This is used by sender.c with a valid f_out, and by receive.c with
-- * f_out = -1. */
--int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr,
-- uchar *type_ptr, char *buf, int *len_ptr)
-+int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
-+ char *buf, int *len_ptr)
- {
- int len, iflags = 0;
- struct file_list *flist;
-@@ -181,11 +180,6 @@ int read_ndx_and_attrs(int f_in, int f_o
- ndx, who_am_i());
- exit_cleanup(RERR_PROTOCOL);
- }
-- } else if (f_out >= 0) {
-- if (inc_recurse)
-- send_extra_file_list(f_out, FILECNT_LOOKAHEAD);
-- write_ndx_and_attrs(f_out, ndx, iflags,
-- fnamecmp_type, buf, len);
- }
-
- *iflag_ptr = iflags;
-@@ -247,6 +241,9 @@ int set_file_attrs(char *fname, struct f
- #ifdef SUPPORT_ACLS
- sx2.acc_acl = sx2.def_acl = NULL;
- #endif
-+#ifdef SUPPORT_XATTRS
-+ sx2.xattr = NULL;
-+#endif
- if (!preserve_perms && S_ISDIR(new_mode)
- && sx2.st.st_mode & S_ISGID) {
- /* We just created this directory and its setgid
-@@ -321,6 +318,10 @@ int set_file_attrs(char *fname, struct f
- if (daemon_chmod_modes && !S_ISLNK(new_mode))
- new_mode = tweak_mode(new_mode, daemon_chmod_modes);
-
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs && !am_generator)
-+ set_xattr(fname, file, sxp);
-+#endif
- #ifdef SUPPORT_ACLS
- /* It's OK to call set_acl() now, even for a dir, as the generator
- * will enable owner-writability using chmod, if necessary.
-@@ -353,10 +354,16 @@ int set_file_attrs(char *fname, struct f
- rprintf(FCLIENT, "%s is uptodate\n", fname);
- }
- cleanup:
-+ if (sxp == &sx2) {
- #ifdef SUPPORT_ACLS
-- if (preserve_acls && sxp == &sx2)
-- free_acl(&sx2);
-+ if (preserve_acls)
-+ free_acl(&sx2);
- #endif
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs)
-+ free_xattr(&sx2);
-+#endif
-+ }
- return updated;
- }
-
---- old/rsync.h
-+++ new/rsync.h
-@@ -569,6 +569,7 @@ extern int file_extra_cnt;
- extern int preserve_uid;
- extern int preserve_gid;
- extern int preserve_acls;
-+extern int preserve_xattrs;
-
- #define FILE_STRUCT_LEN (offsetof(struct file_struct, basename))
- #define EXTRA_LEN (sizeof (union file_extras))
-@@ -601,7 +602,8 @@ extern int preserve_acls;
- /* When the associated option is on, all entries will have these present: */
- #define F_OWNER(f) REQ_EXTRA(f, preserve_uid)->unum
- #define F_GROUP(f) REQ_EXTRA(f, preserve_gid)->unum
--#define F_ACL(f) REQ_EXTRA(f, preserve_acls)->unum
-+#define F_ACL(f) REQ_EXTRA(f, preserve_acls)->num
-+#define F_XATTR(f) REQ_EXTRA(f, preserve_xattrs)->num
-
- /* These items are per-entry optional and mutally exclusive: */
- #define F_HL_GNUM(f) OPT_EXTRA(f, LEN64_BUMP(f))->num
-@@ -793,9 +795,13 @@ typedef struct {
- struct rsync_acl *acc_acl; /* access ACL */
- struct rsync_acl *def_acl; /* default ACL */
- #endif
-+#ifdef SUPPORT_XATTRS
-+ item_list *xattr;
-+#endif
- } statx;
-
- #define ACL_READY(sx) ((sx).acc_acl != NULL)
-+#define XATTR_READY(sx) ((sx).xattr != NULL)
-
- #include "proto.h"
-
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -301,7 +301,7 @@ to the detailed description below for a
- -q, --quiet suppress non-error messages
- --no-motd suppress daemon-mode MOTD (see caveat)
- -c, --checksum skip based on checksum, not mod-time & size
-- -a, --archive archive mode; same as -rlptgoD (no -H, -A)
-+ -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
- --no-OPTION turn off an implied OPTION (e.g. --no-D)
- -r, --recursive recurse into directories
- -R, --relative use relative path names
-@@ -324,6 +324,7 @@ to the detailed description below for a
- -E, --executability preserve executability
- --chmod=CHMOD affect file and/or directory permissions
- -A, --acls preserve ACLs (implies -p)
-+ -X, --xattrs preserve extended attrs (implies -p)
- -o, --owner preserve owner (super-user only)
- -g, --group preserve group
- --devices preserve device files (super-user only)
-@@ -831,6 +832,11 @@ dit(bf(-A, --acls)) This option causes r
- ACLs to be the same as the source ACLs. This nonstandard option only
- works if the remote rsync also supports it. bf(--acls) implies bf(--perms).