summaryrefslogtreecommitdiff
path: root/src/copy.h
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2009-01-23 12:17:53 +0100
committerJim Meyering <meyering@redhat.com>2009-01-29 13:26:07 +0100
commit0889381cbfdbb4895e6b8693d14c0f5c77bc85bc (patch)
tree1c93168a0d0c7e5ff72df37c4b34607b0eb3aaea /src/copy.h
parent1bdf77ad523fca6f3781f5614706246f20394a62 (diff)
downloadcoreutils-0889381cbfdbb4895e6b8693d14c0f5c77bc85bc.tar.gz
cp/mv: add xattr support
This patch was originally written by Andreas Grünbacher, nowadays available at http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff * bootstrap.conf: Add gnulib module verror. * po/POTFILES.in: Add lib/verror.c. * m4/xattr.m4: Check for libattr availability, new configure option --disable-xattr. * m4/prereq.m4: Require gl_FUNC_XATTR. * src/Makefile.am: Link cp, mv and ginstall with libattr. * src/copy.h: Add preserve_xattr and require_preserve_xattr to cp_options. * src/copy.c (copy_attr_error): New function to handle errors during xattr copying. (copy_attr_quote): New function to quote file name in error messages printed by libattr. (copy_attr_free): Empty function requested by libattr to free quoted string. (copy_attr_by_fd): New fd-oriented function to copy xattr. (copy_attr_by_name): New name-oriented function to copy xattr. (copy_reg, copy_internal): Call copy_extended_attributes function. * src/cp.c (usage): Mention new --preserve=xattr option. (decode_preserve_arg): Handle new --preserve=xattr option. * src/mv.c: Always attempt to preserve xattr. * src/install.c: Never attempt to preserve xattr. * tests/misc/xattr: New test for xattr support in cp, mv and install. * tests/Makefile.am: Add the new test to list. * doc/coreutils.texi: Mention xattr support, new --preserve=xattr option. * NEWS: Mention the change.
Diffstat (limited to 'src/copy.h')
-rw-r--r--src/copy.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/copy.h b/src/copy.h
index 12b7c2d28..e6604ee71 100644
--- a/src/copy.h
+++ b/src/copy.h
@@ -173,6 +173,19 @@ struct cp_options
fail if it is unable to do so. */
bool require_preserve_context;
+ /* If true, attempt to preserve extended attributes using libattr.
+ Ignored if coreutils are compiled without xattr support. */
+ bool preserve_xattr;
+
+ /* Useful only when preserve_xattr is true.
+ If true, a failed attempt to preserve file's extended attributes
+ propagates failure "out" to the caller. If false, a failure to
+ preserve file's extended attributes does not change the invoking
+ application's exit status. Give diagnostics for failed syscalls
+ regardless of this setting. For example, with "cp --preserve=xattr"
+ this flag is "true", while with "cp --preserve=all", it is false. */
+ bool require_preserve_xattr;
+
/* If true, copy directories recursively and copy special files
as themselves rather than copying their contents. */
bool recursive;