4 /* Control creation of sparse files (files with holes). */
9 /* Never create holes in DEST. */
12 /* This is the default. Use a crude (and sometimes inaccurate)
13 heuristic to determine if SOURCE has holes. If so, try to create
17 /* For every sufficiently long sequence of bytes in SOURCE, try to
18 create a corresponding hole in DEST. There is a performance penalty
19 here because CP has to search for holes in SRC. But if the holes are
20 big enough, that penalty can be offset by the decrease in the amount
21 of data written to disk. */
25 # define VALID_SPARSE_MODE(Mode) \
26 ((Mode) == SPARSE_NEVER \
27 || (Mode) == SPARSE_AUTO \
28 || (Mode) == SPARSE_ALWAYS)
32 enum backup_type backup_type;
34 /* If nonzero, copy all files except (directories and, if not dereferencing
35 them, symbolic links,) as if they were regular files. */
38 /* If nonzero, dereference symbolic links (copy the files they point to). */
41 /* If nonzero, remove existing destination nondirectories. */
44 /* Setting this member is meaningful only if FORCE is also set.
45 If nonzero, copy returns nonzero upon failed unlink.
46 Otherwise, the failure still elicits a diagnostic, but it doesn't
47 change copy's return value. This is nonzero for cp and mv, and zero
49 int failed_unlink_is_fatal;
51 /* If nonzero, create hard links instead of copying files.
52 Create destination directories as usual. */
55 /* If nonzero, query before overwriting existing destinations
56 with regular files. */
59 /* If nonzero, rather than copying, first attempt to use rename.
60 If that fails, then resort to copying. */
63 /* This process's effective user ID. */
66 /* If nonzero, when copying recursively, skip any subdirectories that are
67 on different filesystems from the one we started on. */
70 /* If nonzero, attempt to give the copies the original files' permissions,
71 owner, group, and timestamps. */
72 int preserve_owner_and_group;
73 int preserve_chmod_bits;
74 int preserve_timestamps;
76 /* If nonzero and any of the above (for preserve) file attributes cannot
77 be applied to a destination file, treat it as a failure and return
78 nonzero immediately. E.g. cp -p requires this be nonzero, mv requires
82 /* If nonzero, copy directories recursively and copy special files
83 as themselves rather than copying their contents. */
86 /* If nonzero, set file mode to value of MODE. Otherwise,
87 set it based on current umask modified by UMASK_KILL. */
90 /* Set the mode of the destination file to exactly this value
91 if USE_MODE is nonzero. */
94 /* Control creation of sparse files. */
95 enum Sparse_type sparse_mode;
97 /* If nonzero, create symbolic links instead of copying files.
98 Create destination directories as usual. */
101 /* The bits to preserve in created files' modes. */
104 /* If nonzero, do not copy a nondirectory that has an existing destination
105 with the same or newer modification time. */
108 /* If nonzero, display the names of the files before copying them. */
111 /* A pointer to either lstat or stat, depending on
112 whether the copy should dereference symlinks. */
117 copy PARAMS ((const char *src_path, const char *dst_path,
118 int nonexistent_dst, const struct cp_options *options,
119 int *copy_into_self, int *rename_succeeded));