diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2012-08-28 06:02:59 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2012-08-28 06:02:59 +0000 |
commit | 0e31848fc1e7070c289ef22082f8b2d5b4f1f268 (patch) | |
tree | 053ffbb983b03781426b9855d64b98df4b585359 /bin/cp/cp.c | |
parent | 725d54f304e9915ae6f7ce7a481640c896d309d6 (diff) |
Don't order file and dir creation, no measurable effect, ffs
allocation strategy has changed since a long time and added to that
cp(1) should not try to be smart and guess things it shouldn't know.
ok guenther@ krw@
Diffstat (limited to 'bin/cp/cp.c')
-rw-r--r-- | bin/cp/cp.c | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/bin/cp/cp.c b/bin/cp/cp.c index c0e7472aaf1..27ad524d435 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cp.c,v 1.34 2007/11/04 02:01:57 tedu Exp $ */ +/* $OpenBSD: cp.c,v 1.35 2012/08/28 06:02:58 otto Exp $ */ /* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */ /* @@ -77,7 +77,6 @@ mode_t myumask; enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE }; int copy(char *[], enum op, int); -int mastercmp(const FTSENT **, const FTSENT **); char *find_last_component(char *); int @@ -260,7 +259,7 @@ copy(char *argv[], enum op type, int fts_options) char *p, *target_mid; base = 0; - if ((ftsp = fts_open(argv, fts_options, mastercmp)) == NULL) + if ((ftsp = fts_open(argv, fts_options, NULL)) == NULL) err(1, NULL); for (rval = 0; (curr = fts_read(ftsp)) != NULL;) { switch (curr->fts_info) { @@ -446,29 +445,3 @@ copy(char *argv[], enum op type, int fts_options) (void)fts_close(ftsp); return (rval); } - -/* - * mastercmp -- - * The comparison function for the copy order. The order is to copy - * non-directory files before directory files. The reason for this - * is because files tend to be in the same cylinder group as their - * parent directory, whereas directories tend not to be. Copying the - * files first reduces seeking. - */ -int -mastercmp(const FTSENT **a, const FTSENT **b) -{ - int a_info, b_info; - - a_info = (*a)->fts_info; - if (a_info == FTS_ERR || a_info == FTS_NS || a_info == FTS_DNR) - return (0); - b_info = (*b)->fts_info; - if (b_info == FTS_ERR || b_info == FTS_NS || b_info == FTS_DNR) - return (0); - if (a_info == FTS_D) - return (-1); - if (b_info == FTS_D) - return (1); - return (0); -} |