Lines Matching refs:x

125                            const struct cp_options *x,
130 static bool owner_failure_ok (struct cp_options const *x);
184 emit_debug (const struct cp_options *x) in emit_debug() argument
186 if (! x->hard_link && ! x->symbolic_link && x->data_copy_required) in emit_debug()
761 char const *dst_path, int dst_fd, struct cp_options const *x) in copy_attr() argument
763 bool all_errors = (!x->data_copy_required || x->require_preserve_xattr); in copy_attr()
764 bool some_errors = (!all_errors && !x->reduce_diagnostics); in copy_attr()
766 = (x->preserve_security_context || x->set_security_context in copy_attr()
797 MAYBE_UNUSED struct cp_options const *x) in copy_attr() argument
820 const struct cp_options *x, in copy_dir() argument
826 struct cp_options non_command_line_options = *x; in copy_dir()
840 if (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS) in copy_dir()
920 set_owner (const struct cp_options *x, char const *dst_name, in set_owner() argument
934 if (!new_dst && (x->preserve_mode || x->move_mode || x->set_mode)) in set_owner()
938 (x->preserve_mode || x->move_mode ? src_sb->st_mode : x->mode); in set_owner()
946 if (! owner_failure_ok (x)) in set_owner()
949 return -x->require_preserve; in set_owner()
959 if (chown_failure_ok (x)) in set_owner()
966 if (x->require_preserve) in set_owner()
1017 mode_t mode, bool new_dst, const struct cp_options *x) in set_process_security_ctx() argument
1019 if (x->preserve_security_context) in set_process_security_ctx()
1022 bool all_errors = !x->data_copy_required || x->require_preserve_context; in set_process_security_ctx()
1023 bool some_errors = !all_errors && !x->reduce_diagnostics; in set_process_security_ctx()
1034 if (x->require_preserve_context) in set_process_security_ctx()
1050 if (x->require_preserve_context) in set_process_security_ctx()
1054 else if (x->set_security_context) in set_process_security_ctx()
1058 if (new_dst && defaultcon (x->set_security_context, dst_name, mode) < 0 in set_process_security_ctx()
1079 bool recurse, const struct cp_options *x) in set_file_security_ctx() argument
1081 bool all_errors = (!x->data_copy_required in set_file_security_ctx()
1082 || x->require_preserve_context); in set_file_security_ctx()
1083 bool some_errors = !all_errors && !x->reduce_diagnostics; in set_file_security_ctx()
1085 if (! restorecon (x->set_security_context, dst_name, recurse)) in set_file_security_ctx()
1230 const struct cp_options *x, in copy_reg() argument
1243 bool data_copy_required = x->data_copy_required; in copy_reg()
1244 bool preserve_xattr = USE_XATTR & x->preserve_xattr; in copy_reg()
1247 copy_debug.reflink = x->reflink_mode ? COPY_DEBUG_UNKNOWN : COPY_DEBUG_NO; in copy_reg()
1252 | (x->dereference == DEREF_NEVER ? O_NOFOLLOW : 0))); in copy_reg()
1299 && (x->set_security_context || x->preserve_security_context)) in copy_reg()
1301 if (! set_file_security_ctx (dst_name, false, x)) in copy_reg()
1303 if (x->require_preserve_context) in copy_reg()
1312 && x->unlink_dest_after_failed_open) in copy_reg()
1316 if (x->verbose) in copy_reg()
1333 if (x->set_security_context) in copy_reg()
1336 true, x)) in copy_reg()
1362 if (data_copy_required && x->reflink_mode in copy_reg()
1363 && (CLONE_NOOWNERCOPY || x->preserve_ownership)) in copy_reg()
1371 = (x->preserve_mode ? src_mode & CHMOD_MODE_BITS in copy_reg()
1372 : x->set_mode ? x->mode in copy_reg()
1373 : ((x->explicit_no_preserve_mode ? MODE_RW_UGO : dst_mode) in copy_reg()
1379 | (x->preserve_mode ? CLONE_ACL : 0) in copy_reg()
1380 | (x->preserve_ownership ? 0 : CLONE_NOOWNERCOPY)); in copy_reg()
1396 if (!x->preserve_timestamps) in copy_reg()
1413 && (!x->preserve_mode || (fc_flags & CLONE_ACL) in copy_reg()
1428 x->reflink_mode)) in copy_reg()
1437 else if (data_copy_required && x->reflink_mode) in copy_reg()
1449 | (preserve_xattr && !x->owner_privileges ? S_IWUSR : 0)); in copy_reg()
1467 if (dest_desc < 0 && dest_errno == EEXIST && ! x->move_mode) in copy_reg()
1472 if (x->open_dangling_dest_symlink) in copy_reg()
1508 if (data_copy_required && x->reflink_mode) in copy_reg()
1518 dest_desc, *new_dst, x->reflink_mode)) in copy_reg()
1526 if (! (data_copy_required | x->preserve_ownership | extra_permissions)) in copy_reg()
1561 && (x->sparse_mode == SPARSE_ALWAYS in copy_reg()
1562 || (x->sparse_mode == SPARSE_AUTO in copy_reg()
1600 make_holes ? x->sparse_mode : SPARSE_NEVER, in copy_reg()
1601 x->reflink_mode != REFLINK_NEVER, in copy_reg()
1607 x->sparse_mode == SPARSE_ALWAYS, in copy_reg()
1608 x->reflink_mode != REFLINK_NEVER, in copy_reg()
1623 if (x->preserve_timestamps) in copy_reg()
1632 if (x->require_preserve) in copy_reg()
1642 if (x->preserve_ownership && ! SAME_OWNER_AND_GROUP (*src_sb, sb)) in copy_reg()
1644 switch (set_owner (x, dst_name, dst_dirfd, dst_relname, dest_desc, in copy_reg()
1659 if (!copy_attr (src_name, source_desc, dst_name, dest_desc, x) in copy_reg()
1660 && x->require_preserve_xattr) in copy_reg()
1669 if (x->preserve_mode || x->move_mode) in copy_reg()
1672 && x->require_preserve) in copy_reg()
1675 else if (x->set_mode) in copy_reg()
1677 if (set_acl (dst_name, dest_desc, x->mode) != 0) in copy_reg()
1680 else if (x->explicit_no_preserve_mode && *new_dst) in copy_reg()
1695 if (x->require_preserve) in copy_reg()
1717 if (x->debug) in copy_reg()
1718 emit_debug (x); in copy_reg()
1738 const struct cp_options *x, bool *return_now) in same_file_ok() argument
1755 if (same && x->hard_link) in same_file_ok()
1761 if (x->dereference == DEREF_NEVER) in same_file_ok()
1774 if (x->backup_type != no_backups) in same_file_ok()
1784 return ! x->move_mode; in same_file_ok()
1815 && x->unlink_dest_before_opening) in same_file_ok()
1824 if (x->backup_type != no_backups) in same_file_ok()
1844 if ( ! x->move_mode in same_file_ok()
1845 && x->dereference != DEREF_NEVER in same_file_ok()
1865 if (x->hard_link in same_file_ok()
1870 if (x->dereference != DEREF_NEVER) in same_file_ok()
1874 if (x->move_mode || x->unlink_dest_before_opening) in same_file_ok()
1888 return ! x->move_mode; in same_file_ok()
1899 if (x->hard_link) in same_file_ok()
1926 if (x->move_mode in same_file_ok()
1941 if (x->symbolic_link && S_ISLNK (dst_sb_link->st_mode)) in same_file_ok()
1944 if (x->dereference == DEREF_NEVER) in same_file_ok()
1959 if (x->hard_link) in same_file_ok()
1985 overwrite_ok (struct cp_options const *x, char const *dst_name, in overwrite_ok() argument
1995 (x->move_mode || x->unlink_dest_before_opening in overwrite_ok()
1996 || x->unlink_dest_after_failed_open) in overwrite_ok()
2015 dest_info_init (struct cp_options *x) in dest_info_init() argument
2017 x->dest_info in dest_info_init()
2023 if (! x->dest_info) in dest_info_init()
2030 src_info_init (struct cp_options *x) in src_info_init() argument
2041 x->src_info in src_info_init()
2047 if (! x->src_info) in src_info_init()
2059 abandon_move (const struct cp_options *x, in abandon_move() argument
2064 affirm (x->move_mode); in abandon_move()
2065 return (x->interactive == I_ALWAYS_NO in abandon_move()
2066 || x->interactive == I_ALWAYS_SKIP in abandon_move()
2067 || ((x->interactive == I_ASK_USER in abandon_move()
2068 || (x->interactive == I_UNSPECIFIED in abandon_move()
2069 && x->stdin_tty in abandon_move()
2072 && ! overwrite_ok (x, dst_name, dst_dirfd, dst_relname, dst_sb))); in abandon_move()
2148 should_dereference (const struct cp_options *x, bool command_line_arg) in should_dereference() argument
2150 return x->dereference == DEREF_ALWAYS in should_dereference()
2151 || (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS in should_dereference()
2199 const struct cp_options *x, in copy_internal() argument
2222 int rename_errno = x->rename_errno; in copy_internal()
2223 if (x->move_mode) in copy_internal()
2233 ? !x->last_file in copy_internal()
2235 || (x->interactive != I_ALWAYS_NO && x->interactive != I_ALWAYS_SKIP)) in copy_internal()
2241 = x->dereference == DEREF_NEVER ? AT_SYMLINK_NOFOLLOW : 0; in copy_internal()
2250 if (S_ISDIR (src_mode) && !x->recursive) in copy_internal()
2252 error (0, 0, ! x->install_mode /* cp */ in copy_internal()
2262 affirm (x->move_mode); in copy_internal()
2271 if (command_line_arg && x->src_info) in copy_internal()
2274 && x->backup_type == no_backups in copy_internal()
2275 && seen_file (x->src_info, src_name, &src_sb)) in copy_internal()
2282 record_file (x->src_info, src_name, &src_sb); in copy_internal()
2285 bool dereference = should_dereference (x, command_line_arg); in copy_internal()
2303 && (x->interactive == I_ALWAYS_NO in copy_internal()
2304 || x->interactive == I_ALWAYS_SKIP))) in copy_internal()
2314 && (! x->copy_as_regular in copy_internal()
2316 || x->move_mode || x->symbolic_link || x->hard_link in copy_internal()
2317 || x->backup_type != no_backups in copy_internal()
2318 || x->unlink_dest_before_opening); in copy_internal()
2330 && x->unlink_dest_after_failed_open) in copy_internal()
2348 if ((x->interactive != I_ALWAYS_NO && x->interactive != I_ALWAYS_SKIP) in copy_internal()
2350 &dst_sb, x, &return_now)) in copy_internal()
2357 if (x->update && !S_ISDIR (src_mode)) in copy_internal()
2363 int options = ((x->preserve_timestamps in copy_internal()
2364 && ! (x->move_mode in copy_internal()
2393 x->verbose, dereference)) in copy_internal()
2411 if (x->move_mode) in copy_internal()
2413 if (abandon_move (x, dst_name, dst_dirfd, drelname, &dst_sb)) in copy_internal()
2421 return_val = x->interactive == I_ALWAYS_SKIP; in copy_internal()
2427 && (x->interactive == I_ALWAYS_NO in copy_internal()
2428 || x->interactive == I_ALWAYS_SKIP in copy_internal()
2429 || (x->interactive == I_ASK_USER in copy_internal()
2430 && ! overwrite_ok (x, dst_name, dst_dirfd, in copy_internal()
2434 return_val = x->interactive == I_ALWAYS_SKIP; in copy_internal()
2441 if (x->interactive == I_ALWAYS_NO) in copy_internal()
2443 else if (x->debug) in copy_internal()
2456 if (x->move_mode && x->backup_type != no_backups) in copy_internal()
2478 && x->backup_type != numbered_backups in copy_internal()
2479 && seen_file (x->dest_info, dst_relname, &dst_sb)) in copy_internal()
2492 if (x->move_mode && x->backup_type != no_backups) in copy_internal()
2507 if (x->move_mode) in copy_internal()
2511 && x->backup_type == no_backups) in copy_internal()
2521 if (x->backup_type != no_backups in copy_internal()
2530 && (x->move_mode || ! S_ISDIR (dst_sb.st_mode))) in copy_internal()
2536 if (x->backup_type != numbered_backups in copy_internal()
2541 fmt = (x->move_mode in copy_internal()
2551 x->backup_type); in copy_internal()
2576 && ! x->move_mode in copy_internal()
2577 && (x->unlink_dest_before_opening in copy_internal()
2578 || (x->data_copy_required in copy_internal()
2579 && ((x->preserve_links && 1 < dst_sb.st_nlink) in copy_internal()
2580 || (x->dereference == DEREF_NEVER in copy_internal()
2590 if (x->verbose) in copy_internal()
2599 && x->dest_info in copy_internal()
2600 && ! x->move_mode in copy_internal()
2601 && x->backup_type == no_backups) in copy_internal()
2614 && seen_file (x->dest_info, dst_relname, dst_lstat_sb)) in copy_internal()
2627 if (x->verbose && !x->move_mode && !S_ISDIR (src_mode)) in copy_internal()
2662 else if (x->recursive && S_ISDIR (src_mode)) in copy_internal()
2670 else if (x->move_mode && src_sb.st_nlink == 1) in copy_internal()
2674 else if (x->preserve_links in copy_internal()
2675 && !x->hard_link in copy_internal()
2678 && x->dereference == DEREF_COMMAND_LINE_ARGUMENTS) in copy_internal()
2679 || x->dereference == DEREF_ALWAYS)) in copy_internal()
2715 if (x->move_mode && rename_succeeded) in copy_internal()
2721 else if (x->dereference == DEREF_ALWAYS in copy_internal()
2723 && x->dereference == DEREF_COMMAND_LINE_ARGUMENTS)) in copy_internal()
2746 true, x->verbose, dereference)) in copy_internal()
2753 if (x->move_mode) in copy_internal()
2761 if (x->verbose) in copy_internal()
2767 if (x->set_security_context) in copy_internal()
2770 (void) set_file_security_ctx (dst_name, true, x); in copy_internal()
2776 if (command_line_arg && !x->last_file) in copy_internal()
2785 record_file (x->dest_info, dst_relname, &src_sb); in copy_internal()
2831 if (rename_errno != EXDEV || x->no_copy) in copy_internal()
2885 if (x->verbose && !S_ISDIR (src_mode)) in copy_internal()
2897 dst_mode_bits = (x->set_mode ? x->mode : src_mode) & CHMOD_MODE_BITS; in copy_internal()
2900 & (x->preserve_ownership ? S_IRWXG | S_IRWXO in copy_internal()
2910 if (! set_process_security_ctx (src_name, dst_name, src_mode, new_dst, x)) in copy_internal()
2984 if (x->verbose) in copy_internal()
2986 if (x->move_mode) in copy_internal()
2999 if (x->set_security_context || x->preserve_security_context) in copy_internal()
3000 if (! set_file_security_ctx (dst_name, false, x)) in copy_internal()
3002 if (x->require_preserve_context) in copy_internal()
3008 if (x->one_file_system && parent && parent->st_dev != src_sb.st_dev) in copy_internal()
3020 new_dst, &src_sb, dir, x, in copy_internal()
3025 else if (x->symbolic_link) in copy_internal()
3058 x->unlink_dest_after_failed_open, -1); in copy_internal()
3080 else if (x->hard_link in copy_internal()
3082 && x->dereference == DEREF_NEVER)) in copy_internal()
3084 bool replace = (x->unlink_dest_after_failed_open in copy_internal()
3085 || x->interactive == I_ASK_USER); in copy_internal()
3092 || (x->copy_as_regular && !S_ISLNK (src_mode))) in copy_internal()
3105 x, dst_mode_bits & S_IRWXUGO, in copy_internal()
3145 x->unlink_dest_after_failed_open, -1); in copy_internal()
3146 if (0 < symlink_err && x->update && !new_dst && S_ISLNK (dst_sb.st_mode) in copy_internal()
3170 if (x->preserve_security_context) in copy_internal()
3173 if (x->preserve_ownership) in copy_internal()
3181 && ! chown_failure_ok (x)) in copy_internal()
3185 if (x->require_preserve) in copy_internal()
3205 if (!new_dst && !x->copy_as_regular && !S_ISDIR (src_mode) in copy_internal()
3206 && (x->set_security_context || x->preserve_security_context)) in copy_internal()
3208 if (! set_file_security_ctx (dst_name, false, x)) in copy_internal()
3210 if (x->require_preserve_context) in copy_internal()
3215 if (command_line_arg && x->dest_info) in copy_internal()
3221 record_file (x->dest_info, dst_relname, &sb); in copy_internal()
3226 if (x->hard_link && ! S_ISDIR (src_mode) in copy_internal()
3228 && x->dereference == DEREF_NEVER)) in copy_internal()
3246 if (x->preserve_timestamps) in copy_internal()
3256 if (x->require_preserve) in copy_internal()
3262 if (!dest_is_symlink && x->preserve_ownership in copy_internal()
3265 switch (set_owner (x, dst_name, dst_dirfd, drelname, -1, in copy_internal()
3278 if (x->preserve_xattr && ! copy_attr (src_name, -1, dst_name, -1, x) in copy_internal()
3279 && x->require_preserve_xattr) in copy_internal()
3288 if (x->preserve_mode || x->move_mode) in copy_internal()
3291 && x->require_preserve) in copy_internal()
3294 else if (x->set_mode) in copy_internal()
3296 if (set_acl (dst_name, -1, x->mode) != 0) in copy_internal()
3299 else if (x->explicit_no_preserve_mode && new_dst) in copy_internal()
3340 if (x->require_preserve) in copy_internal()
3350 if (x->preserve_security_context) in copy_internal()
3369 if (x->verbose) in copy_internal()
3429 cp_options_default (struct cp_options *x) in cp_options_default() argument
3431 memset (x, 0, sizeof *x); in cp_options_default()
3439 x->chown_privileges = priv_ismember (pset, PRIV_FILE_CHOWN); in cp_options_default()
3440 x->owner_privileges = priv_ismember (pset, PRIV_FILE_OWNER); in cp_options_default()
3445 x->chown_privileges = x->owner_privileges = (geteuid () == ROOT_UID); in cp_options_default()
3447 x->rename_errno = -1; in cp_options_default()
3455 chown_failure_ok (struct cp_options const *x) in chown_failure_ok() argument
3468 && !x->chown_privileges); in chown_failure_ok()
3476 owner_failure_ok (struct cp_options const *x) in owner_failure_ok() argument
3479 && !x->owner_privileges); in owner_failure_ok()