From 5bf65105dbaf0bb3d6fb4ccb3d8790bda496d861 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Fri, 10 Jan 2003 14:42:47 +0000 Subject: [PATCH] Largefile version of seek in rmt. --- CHANGES | 4 +++- common/dumprmt.c | 8 ++++---- compat/include/compatlfs.h | 4 +++- dump/dump.h | 5 +++-- restore/dirs.c | 4 ++-- restore/extern.h | 5 +++-- restore/tape.c | 8 ++++---- rmt/rmt.c | 4 ++-- 8 files changed, 24 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index 0a2e603..0e16055 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.205 2003/01/10 10:52:48 stelian Exp $ +$Id: CHANGES,v 1.206 2003/01/10 14:42:47 stelian Exp $ Changes between versions 0.4b32 and 0.4b33 (released ?????????????????) ======================================================================= @@ -34,6 +34,8 @@ Changes between versions 0.4b32 and 0.4b33 (released ?????????????????) a dump. Thanks to Michal Szymanski for the suggestions. +7. Made rmt understand long (largefiles) seeks. + Changes between versions 0.4b31 and 0.4b32 (released November 15, 2002) ======================================================================= diff --git a/common/dumprmt.c b/common/dumprmt.c index f89a13d..1d49a24 100644 --- a/common/dumprmt.c +++ b/common/dumprmt.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: dumprmt.c,v 1.23 2002/07/29 12:00:33 stelian Exp $"; + "$Id: dumprmt.c,v 1.24 2003/01/10 14:42:50 stelian Exp $"; #endif /* not lint */ #include @@ -331,12 +331,12 @@ rmtwrite(const char *buf, size_t count) return (rmtreply("write")); } -int -rmtseek(int offset, int pos) +OFF_T +rmtseek(OFF_T offset, int pos) { char line[80]; - (void)snprintf(line, sizeof (line), "L%d\n%d\n", offset, pos); + (void)snprintf(line, sizeof (line), "L%lld\n%d\n", (long long)offset, pos); return (rmtcall("seek", line)); } diff --git a/compat/include/compatlfs.h b/compat/include/compatlfs.h index 8cd0f96..85c987f 100644 --- a/compat/include/compatlfs.h +++ b/compat/include/compatlfs.h @@ -3,7 +3,7 @@ * dump and restore backup suit * Stelian Pop - Alcôve , 2000-2002 * - * $Id: compatlfs.h,v 1.2 2002/01/16 09:32:14 stelian Exp $ + * $Id: compatlfs.h,v 1.3 2003/01/10 14:42:50 stelian Exp $ */ /*- @@ -52,6 +52,7 @@ #define STAT stat64 #define LSTAT lstat64 #define FTRUNCATE ftruncate64 +#define OFF_T __off64_t #else @@ -60,6 +61,7 @@ #define STAT stat #define LSTAT lstat #define FTRUNCATE ftruncate +#define OFF_T off_t #endif /* USE_LFS */ diff --git a/dump/dump.h b/dump/dump.h index c4d8dca..3121074 100644 --- a/dump/dump.h +++ b/dump/dump.h @@ -5,7 +5,7 @@ * Stelian Pop , 1999-2000 * Stelian Pop - Alcôve , 2000-2002 * - * $Id: dump.h,v 1.41 2002/12/12 11:49:35 stelian Exp $ + * $Id: dump.h,v 1.42 2003/01/10 14:42:50 stelian Exp $ */ /*- @@ -43,6 +43,7 @@ #include #include +#include #define MAXINOPB (MAXBSIZE / sizeof(struct dinode)) #define MAXNINDIR (MAXBSIZE / sizeof(daddr_t)) @@ -190,7 +191,7 @@ int rmtopen __P((const char *tape, const int mode)); void rmtclose __P((void)); int rmtread __P((char *buf, size_t count)); int rmtwrite __P((const char *buf, size_t count)); -int rmtseek __P((int offset, int pos)); +OFF_T rmtseek __P((OFF_T offset, int pos)); struct mtget * rmtstatus __P((void)); int rmtioctl __P((int cmd, int count)); #endif /* RDUMP */ diff --git a/restore/dirs.c b/restore/dirs.c index 2288777..2be4e52 100644 --- a/restore/dirs.c +++ b/restore/dirs.c @@ -46,7 +46,7 @@ #ifndef lint static const char rcsid[] = - "$Id: dirs.c,v 1.21 2002/07/19 14:57:39 stelian Exp $"; + "$Id: dirs.c,v 1.22 2003/01/10 14:42:51 stelian Exp $"; #endif /* not lint */ #include @@ -587,7 +587,7 @@ static long rst_telldir(RST_DIR *dirp) { return ((long)lseek(dirp->dd_fd, - (off_t)0, SEEK_CUR) - dirp->dd_size + dirp->dd_loc); + (OFF_T)0, SEEK_CUR) - dirp->dd_size + dirp->dd_loc); } /* diff --git a/restore/extern.h b/restore/extern.h index 6ea57e3..ce2a041 100644 --- a/restore/extern.h +++ b/restore/extern.h @@ -5,7 +5,7 @@ * Stelian Pop , 1999-2000 * Stelian Pop - Alcôve , 2000-2002 * - * $Id: extern.h,v 1.20 2002/11/15 09:25:41 stelian Exp $ + * $Id: extern.h,v 1.21 2003/01/10 14:42:51 stelian Exp $ */ /*- @@ -42,6 +42,7 @@ */ #include +#include struct entry *addentry __P((char *, dump_ino_t, int)); long addfile __P((char *, dump_ino_t, int)); @@ -121,7 +122,7 @@ int rmthost __P((const char *)); int rmtioctl __P((int, int)); int rmtopen __P((const char *, const int)); int rmtread __P((const char *, int)); -int rmtseek __P((int, int)); +OFF_T rmtseek __P((OFF_T, int)); /* From e2fsprogs */ int fsetflags __P((const char *, unsigned long)); diff --git a/restore/tape.c b/restore/tape.c index 5543cfb..2bb4472 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -46,7 +46,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.66 2002/11/28 08:54:00 stelian Exp $"; + "$Id: tape.c,v 1.67 2003/01/10 14:42:51 stelian Exp $"; #endif /* not lint */ #include @@ -1019,7 +1019,7 @@ static void xtrskip(UNUSED(char *buf), size_t size) { - if (LSEEK(ofile, (off_t)size, SEEK_CUR) == -1) + if (LSEEK(ofile, (OFF_T)size, SEEK_CUR) == -1) err(1, "seek error extracting inode %lu, name %s\nlseek", (unsigned long)curfile.ino, curfile.name); } @@ -1547,7 +1547,7 @@ getmore: seek_failed = (rmtseek(i, 1) < 0); else #endif - seek_failed = (LSEEK(mt, i, SEEK_CUR) == (off_t)-1); + seek_failed = (LSEEK(mt, i, SEEK_CUR) == (OFF_T)-1); if (seek_failed) { warn("continuation failed"); @@ -2589,7 +2589,7 @@ GotoTapePos(long long pos) #ifdef RDUMP if (host) - err = (rmtseek((long)pos, SEEK_SET) < 0); + err = (rmtseek(pos, SEEK_SET) < 0); else #endif { diff --git a/rmt/rmt.c b/rmt/rmt.c index fc6eb82..3167e1d 100644 --- a/rmt/rmt.c +++ b/rmt/rmt.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: rmt.c,v 1.21 2002/07/29 12:00:34 stelian Exp $"; + "$Id: rmt.c,v 1.22 2003/01/10 14:42:51 stelian Exp $"; #endif /* not linux */ /* @@ -183,7 +183,7 @@ top: getstring(count); getstring(pos); DEBUG2("rmtd: L %s %s\n", count, pos); - rval = LSEEK(tape, (off_t)atol(count), atoi(pos)); + rval = LSEEK(tape, (OFF_T)atoll(count), atoi(pos)); if (rval < 0) goto ioerror; goto respond; -- 2.39.5