Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/pax Use lseek(2) on devices if not tape drives.
details: https://anonhg.NetBSD.org/src/rev/b86904684ddb
branches: trunk
changeset: 482610:b86904684ddb
user: itohy <itohy%NetBSD.org@localhost>
date: Thu Feb 17 03:08:40 2000 +0000
description:
Use lseek(2) on devices if not tape drives.
This makes listing on raw disk device much faster.
Reviewed and discussed in tech-kern and tech-userlevel lists.
diffstat:
bin/pax/ar_io.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diffs (49 lines):
diff -r 41aee9954dcf -r b86904684ddb bin/pax/ar_io.c
--- a/bin/pax/ar_io.c Thu Feb 17 03:06:12 2000 +0000
+++ b/bin/pax/ar_io.c Thu Feb 17 03:08:40 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ar_io.c,v 1.15 2000/02/17 03:06:12 itohy Exp $ */
+/* $NetBSD: ar_io.c,v 1.16 2000/02/17 03:08:40 itohy Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ar_io.c,v 1.15 2000/02/17 03:06:12 itohy Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.16 2000/02/17 03:08:40 itohy Exp $");
#endif
#endif /* not lint */
@@ -991,7 +991,7 @@
* number of physical blocks to skip (we do not know physical block
* size at this point), so we must only read foward on tapes!
*/
- if (artyp != ISREG)
+ if (artyp == ISTAPE || artyp == ISPIPE)
return(0);
/*
@@ -1004,13 +1004,16 @@
* deal with the end of file (it will go to next volume by
* itself)
*/
- if ((mpos = cpos + sksz) > arsb.st_size) {
- *skipped = arsb.st_size - cpos;
+ mpos = cpos + sksz;
+ if (artyp == ISREG && mpos > arsb.st_size)
mpos = arsb.st_size;
- } else
- *skipped = sksz;
- if (lseek(arfd, mpos, SEEK_SET) >= 0)
+ if ((mpos = lseek(arfd, mpos, SEEK_SET)) >= 0) {
+ *skipped = mpos - cpos;
return(0);
+ }
+ } else {
+ if (artyp != ISREG)
+ return(0); /* non-seekable device */
}
syswarn(1, errno, "Foward positioning operation on archive failed");
lstrval = -1;
Home |
Main Index |
Thread Index |
Old Index