]> git.wh0rd.org - dump.git/commitdiff
From Uwe Gohlke:
authorStelian Pop <stelian@popies.net>
Mon, 4 Feb 2002 11:18:45 +0000 (11:18 +0000)
committerStelian Pop <stelian@popies.net>
Mon, 4 Feb 2002 11:18:45 +0000 (11:18 +0000)
- -P option to restore
- compile restore on Solaris
- several code cleanups for QFA features.

CHANGES
dump/optr.c
dump/traverse.c
restore/dirs.c
restore/extern.h
restore/main.c
restore/restore.8.in
restore/restore.c
restore/restore.h
restore/tape.c
restore/utilities.c

diff --git a/CHANGES b/CHANGES
index e6fc0722f5aa640b4d32454bc4e27372642f4d93..214829ce6323a100fbbc1f3a545c6404ef4ab293 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.160 2002/01/31 10:49:16 stelian Exp $
+$Id: CHANGES,v 1.161 2002/02/04 11:18:45 stelian Exp $
 
 Changes between versions 0.4b26 and 0.4b27 (released ???????????????)
 =====================================================================
@@ -36,6 +36,14 @@ Changes between versions 0.4b26 and 0.4b27 (released ???????????????)
        ext2 disk labels (LABEL=/). Thanks to John Yu <jky@it.bu.edu>
        for reporting this bug.
 
+9.     Added the -P <file> option to restore to create a
+       Quick File Access file from an already made dump. Patch 
+       contributed by Uwe Gohlke <uwe@ugsoft.de>.
+
+10.    Made restore compile and run on Solaris, making it a 
+       possible replacement for the standard ufsrestore. Port was
+       contributed by Uwe Gohlke <uwe@ugsoft.de>.
+
 Changes between versions 0.4b25 and 0.4b26 (released January 7, 2002)
 =====================================================================
 
index a580f35843890f4a75e6a35158ec2af7a9142cd2..a79462b24764c4f3aa42204e27ac5f5e36305949 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: optr.c,v 1.30 2002/01/25 15:08:59 stelian Exp $";
+       "$Id: optr.c,v 1.31 2002/02/04 11:18:45 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -469,6 +469,7 @@ getfstab(void)
                    strcmp(fs->fs_type, FSTAB_RQ))
                        continue;
                fs = allocfsent(fs);
+               fs->fs_passno = 0;
                if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL)
                        quit("%s\n", strerror(errno));
                pf->pf_fstab = fs;
index 147717ad37095eb80a40032550f92f39ec80ac6e..eda65e1379e87fa4e1417d6f6295b59529795fb4 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: traverse.c,v 1.42 2002/01/25 15:08:59 stelian Exp $";
+       "$Id: traverse.c,v 1.43 2002/02/04 11:18:46 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -143,15 +143,14 @@ int dump_fs_open(const char *disk, ext2_filsys *fs)
                dump_ino_t journal_ino = ext2_journal_ino(es);
 
                if (es->s_feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV){
-                       fprintf(stderr, "This an journal, not a filesystem!\n");
+                       msg("This is a journal, not a filesystem!\n");
                        retval = EXT2_ET_UNSUPP_FEATURE;
                        ext2fs_close(*fs);
                }
                else if ((retval = es->s_feature_incompat &
                                        ~(EXT2_LIB_FEATURE_INCOMPAT_SUPP |
                                          EXT3_FEATURE_INCOMPAT_RECOVER))) {
-                       fprintf(stderr,
-                               "Unsupported feature(s) 0x%x in filesystem\n",
+                       msg("Unsupported feature(s) 0x%x in filesystem\n",
                                retval);
                        retval = EXT2_ET_UNSUPP_FEATURE;
                        ext2fs_close(*fs);
index 60f5b23673b15eebe42576aa3887ded3b2e8c894..45d4cbe0743981208e96fa82ce6544ee4deb83de 100644 (file)
@@ -46,7 +46,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: dirs.c,v 1.17 2002/01/25 15:08:59 stelian Exp $";
+       "$Id: dirs.c,v 1.18 2002/02/04 11:18:46 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -140,7 +140,7 @@ struct odirect {
        char    d_name[ODIRSIZ];
 };
 
-#ifdef __linux__
+#if defined(__linux__) || defined(sunos)
 static struct inotab   *allocinotab __P((dump_ino_t, struct new_bsd_inode *, long));
 #else
 static struct inotab   *allocinotab __P((dump_ino_t, struct dinode *, long));
@@ -165,7 +165,7 @@ void
 extractdirs(int genmode)
 {
        int i;
-#ifdef __linux__
+#if defined(__linux__) || defined(sunos)
        struct new_bsd_inode *ip;
 #else
        struct dinode *ip;
@@ -325,7 +325,11 @@ pathsearch(const char *pathname)
        while (*path == '/')
                path++;
        dp = NULL;
+#ifdef __linux__
        while ((name = strsep(&path, "/")) != NULL && *name /* != NULL */) {
+#else
+       while ((name = strtok_r(NULL, "/", &path)) != NULL && *name /* != NULL */) {
+#endif
                if ((dp = searchdir(ino, name)) == NULL)
                        return (NULL);
                ino = dp->d_ino;
@@ -431,9 +435,9 @@ putdir(char *buf, size_t size)
 /*
  * These variables are "local" to the following two functions.
  */
-char dirbuf[DIRBLKSIZ];
-long dirloc = 0;
-long prev = 0;
+static char dirbuf[DIRBLKSIZ];
+static long dirloc = 0;
+static long prev = 0;
 
 /*
  * add a new directory entry to a file.
index 7cc98044c46e85fad8ba3e7b819b2baf68e9a220..408169fc5ae49eac8954097cd8b5405a03bfc1fc 100644 (file)
@@ -5,7 +5,7 @@
  *     Stelian Pop <stelian@popies.net>, 1999-2000
  *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
  *
- *     $Id: extern.h,v 1.15 2002/01/25 14:59:53 stelian Exp $
+ *     $Id: extern.h,v 1.16 2002/02/04 11:18:46 stelian Exp $
  */
 
 /*-
@@ -132,5 +132,6 @@ int Inode2Tapepos __P((dump_ino_t, long *, long long *, int));
 int    GetTapePos __P((long long *));
 int    GotoTapePos __P((long long));
 void   ReReadFromTape __P((void));
+void   ReReadInodeFromTape __P((dump_ino_t));
 #endif
 void   RequestVol __P((long));
index fb51380cf600c92078c0f584ce675a2b224f312a..eef486af21c879f57c02cb2ceddd82d600b602fd 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.37 2002/01/25 14:59:53 stelian Exp $";
+       "$Id: main.c,v 1.38 2002/02/04 11:18:46 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #include <compatlfs.h>
+#include <fcntl.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <errno.h>
@@ -109,9 +110,13 @@ char       *gTapeposfile;
 char   gTps[255];
 long   gSeekstart;
 int    tapeposflag;
+int    gTapeposfd;
+int    createtapeposflag;
+unsigned long qfadumpdate;
+long long curtapepos;
 #endif /* USE_QFA */
 
-#ifdef __linux__
+#if defined(__linux__) || defined(sunos)
 char   *__progname;
 #endif
 
@@ -129,17 +134,18 @@ main(int argc, char *argv[])
        char *p, name[MAXPATHLEN];
        FILE *filelist = NULL;
        char fname[MAXPATHLEN];
-#ifdef USE_QFA
-       tapeposflag = 0;
-#endif
-#ifdef USE_QFADEBUG
+#ifdef DEBUG_QFA
        time_t tistart, tiend, titaken;
 #endif
+#ifdef USE_QFA
+       tapeposflag = 0;
+       createtapeposflag = 0;
+#endif /* USE_QFA */
 
        /* Temp files should *not* be readable.  We set permissions later. */
        (void) umask(077);
        filesys[0] = '\0';
-#ifdef __linux__
+#if defined(__linux__) || defined(sunos)
        __progname = argv[0];
 #endif
 
@@ -162,7 +168,7 @@ main(int argc, char *argv[])
 #endif
                "lL:mMN"
 #ifdef USE_QFA
-               "Q:"
+               "P:Q:"
 #endif
                "Rrs:tT:uvVxX:y")) != -1)
                switch(ch) {
@@ -213,6 +219,9 @@ main(int argc, char *argv[])
 #endif
                case 'C':
                case 'i':
+#ifdef USE_QFA
+               case 'P':
+#endif
                case 'R':
                case 'r':
                case 't':
@@ -222,6 +231,13 @@ main(int argc, char *argv[])
                                    "%c and %c options are mutually exclusive",
                                    ch, command);
                        command = ch;
+#ifdef USE_QFA
+                       if (ch == 'P') {
+                               gTapeposfile = optarg;
+                               createtapeposflag = 1;
+                       }
+#endif
+
                        break;
                case 'l':
                        lflag = 1;
@@ -349,10 +365,7 @@ main(int argc, char *argv[])
                if (fgets(gTps, sizeof(gTps), gTapeposfp) == NULL)
                        errx(1, "not requested format of -- %s", gTapeposfile);
                gTps[strlen(gTps) - 1] = 0;
-               /* TODO: check dumpdate from QFA file with current dump file's
-                * dump date */
-               /* if not equal either output warning and continue without QFA
-                * or abort */
+               qfadumpdate = atol(gTps);
                /* read empty line */
                if (fgets(gTps, sizeof(gTps), gTapeposfp) == NULL)
                        errx(1, "not requested format of -- %s", gTapeposfile);
@@ -364,7 +377,7 @@ main(int argc, char *argv[])
                /* end reading header info */
                /* tape position table starts here */
                gSeekstart = ftell(gTapeposfp); /* remember for later use */
-}
+       }
 #endif /* USE_QFA */
 
        switch (command) {
@@ -497,7 +510,7 @@ main(int argc, char *argv[])
         * Batch extraction of tape contents.
         */
        case 'x':
-#ifdef USE_QFADEBUG
+#ifdef DEBUG_QFA
                tistart = time(NULL);
 #endif
                setup();
@@ -520,13 +533,53 @@ main(int argc, char *argv[])
                setdirmodes(0);
                if (dflag)
                        checkrestore();
-#ifdef USE_QFADEBUG
+#ifdef DEBUG_QFA
                tiend = time(NULL);
                titaken = tiend - tistart;
                msg("restore took %d:%02d:%02d\n", titaken / 3600, 
                        (titaken % 3600) / 60, titaken % 60);
-#endif /* USE_QFADEBUG */
+#endif /* DEBUG_QFA */
+               break;
+#ifdef USE_QFA
+       case 'P':
+#ifdef DEBUG_QFA
+               tistart = time(NULL);
+#endif
+               setup();
+               msg("writing QFA positions to %s\n", gTapeposfile);
+               if ((gTapeposfd = open(gTapeposfile, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)) < 0)
+                       errx(1, "can't create tapeposfile\n");
+               /* print QFA-file header */
+               sprintf(gTps, "%s\n%s\n%ld\n\n", QFA_MAGIC, QFA_VERSION,(unsigned long)spcl.c_date);
+               if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps))
+                       errx(1, "can't write tapeposfile\n");
+               sprintf(gTps, "ino\ttapeno\ttapepos\n");
+               if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps))
+                       errx(1, "can't write tapeposfile\n");
+
+               extractdirs(1);
+               initsymtable((char *)0);
+               for (;;) {
+                       NEXTFILE(p);
+                       if (!p)
+                               break;
+                       canon(p, name, sizeof(name));
+                       ino = dirlookup(name);
+                       if (ino == 0)
+                               continue;
+                       if (mflag)
+                               pathcheck(name);
+                       treescan(name, ino, addfile);
+               }
+               createfiles();
+#ifdef DEBUG_QFA
+               tiend = time(NULL);
+               titaken = tiend - tistart;
+               msg("writing QFA positions took %d:%02d:%02d\n", titaken / 3600,
+                       (titaken % 3600) / 60, titaken % 60);
+#endif /* DEBUG_QFA */
                break;
+#endif /* USE_QFA */
        }
        exit(0);
        /* NOTREACHED */
@@ -568,6 +621,10 @@ usage(void)
                "\t%s    [-F script] [-L limit] [-s fileno]\n"
                "\t%s -i [-ach" kerbflag "lmMuvVy] [-A file] [-b blocksize] [-f file]\n"
                "\t%s    [-F script] " qfaflag "[-s fileno]\n"
+#ifdef USE_QFA
+               "\t%s -P file [-ach" kerbflag "lmMuvVy] [-A file] [-b blocksize]\n"
+               "\t%s    [-f file] [-F script] [-s fileno] [-X filelist] [file ...]\n"
+#endif
                "\t%s -r [-c" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script]\n"
                "\t%s    [-s fileno] [-T directory]\n"
                "\t%s -R [-c" kerbflag "lMuvVy] [-b blocksize] [-f file] [-F script]\n"
@@ -578,6 +635,9 @@ usage(void)
                "\t%s    [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]\n",
                __progname, white, 
                __progname, white, 
+#ifdef USE_QFA
+               __progname, white, 
+#endif
                __progname, white,
                __progname, white, 
                __progname, white, 
index 54f289e4fa4e77bd32d9b160b47f1b4c3c11a07a..d9d7fa995c1d98ae2105920a25cd71a92db79395 100644 (file)
@@ -29,7 +29,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    $Id: restore.8.in,v 1.24 2002/01/25 14:59:53 stelian Exp $
+.\"    $Id: restore.8.in,v 1.25 2002/02/04 11:18:46 stelian Exp $
 .\"
 .Dd __DATE__
 .Dt RESTORE 8
 .Op Fl s Ar fileno
 .Op Fl T Ar directory
 .Nm restore
+.Fl P Ar file
+.Op Fl achklmMNuvVy
+.Op Fl A Ar file
+.Op Fl b Ar blocksize
+.Op Fl f Ar file
+.Op Fl F Ar script
+.Op Fl s Ar fileno
+.Op Fl T Ar directory
+.Op Fl X Ar filelist
+.Op file ...
+.Nm restore
 .Fl R
 .Op Fl cklMNuvVy
 .Op Fl b Ar blocksize
@@ -212,6 +223,11 @@ It also causes
 .Nm restore
 to print out information about each file as it is extracted.
 .El
+.It Fl P Ar file
+.Nm Restore
+creates a new Quick File Access file 
+.Ar file
+from an existing dump file without restoring its contents.
 .It Fl R
 .Nm Restore
 requests a particular tape of a multi-volume set on which to restart
index 1b04fea6b9b8b43e81275461eaab2c90e680c222..2a398fc18816e9c7e5ada0ca2fb4c11c856d139b 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: restore.c,v 1.26 2002/01/25 15:08:59 stelian Exp $";
+       "$Id: restore.c,v 1.27 2002/02/04 11:18:46 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -60,9 +60,12 @@ static const char rcsid[] =
 #else  /* __linux__ */
 #include <ufs/ufs/dinode.h>
 #endif /* __linux__ */
+#include <protocols/dumprestore.h>
 
+#include <compaterr.h>
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 
 #ifdef __linux__
 #include <ext2fs/ext2fs.h>
@@ -140,7 +143,11 @@ addfile(char *name, dump_ino_t ino, int type)
                        }
        }
        ep = addentry(name, ino, type);
+#ifdef USE_QFA
+       if ((type == NODE) && (!createtapeposflag))
+#else
        if (type == NODE)
+#endif
                newnode(ep);
        ep->e_flags |= NEW;
        return (descend);
@@ -915,22 +922,31 @@ createfiles(void)
                                if (GetTapePos(&curtpos) == 0) {
                                        /*  curtpos +1000 ???, some drives 
                                         *  might be too slow */
-                                       if (tpos > curtpos) {
+                                       if (tpos != curtpos) {
 #ifdef DEBUG_QFA
                                                msg("positioning tape %ld from %lld to %lld for inode %10lu ...\n", volno, curtpos, tpos, (unsigned long)next);
 #endif
                                                if (GotoTapePos(tpos) == 0) {
 #ifdef DEBUG_QFA
                                                        if (GetTapePos(&curtpos) == 0)
-                                                               msg("before resnyc at tape position %ld\n", curtpos);
+                                                               msg("before resync at tape position %lld (%ld, %ld, %s)\n", curtpos, next, curfile.ino, curfile.name);
 #endif
-                                                       (void)ReReadFromTape();
+msg("bobo1\n");
+                                                       ReReadInodeFromTape(next);
 #ifdef DEBUG_QFA
-                                                       if (GetTapePos(&curtpos) == 0)
-                                                               msg("after resync at tape position %ld\n", curtpos);
+msg("bobo2\n");
+                                                       if (GetTapePos(&curtpos) == 0) {
+msg("bobo3\n");
+                                                               msg("after resync at tape position %lld (%ld, %ld, %s)\n", curtpos, next, curfile.ino, curfile.name);
+msg("bobo4\n");
+                                                       }
 #endif
                                                }
                                        }
+#ifdef DEBUG_QFA
+                                       else
+                                               msg("already at tape %ld position %ld for inode %10lu ...\n", volno, tpos, (unsigned long)next);
+#endif
                                }
                        }
                }
@@ -989,8 +1005,11 @@ createfiles(void)
                        ep = lookupino(next);
                        if (ep == NULL)
                                panic("corrupted symbol table\n");
-                       fprintf(stderr, "%s: (inode %lu) not found on tape\n", 
-                               myname(ep), (unsigned long)next);
+#ifdef USE_QFA
+                       if (!createtapeposflag)
+                               fprintf(stderr, "%s: (inode %lu) not found on tape\n", 
+                                       myname(ep), (unsigned long)next);
+#endif
                        ep->e_flags &= ~NEW;
                        next = lowerbnd(next);
                }
@@ -1002,7 +1021,23 @@ createfiles(void)
                        ep = lookupino(next);
                        if (ep == NULL)
                                panic("corrupted symbol table\n");
-                       (void) extractfile(myname(ep));
+#ifdef USE_QFA
+                       if (createtapeposflag) {
+#ifdef DEBUG_QFA
+                               msg("inode %ld at tapepos %ld\n", curfile.ino, curtapepos);
+#endif
+                               sprintf(gTps, "%ld\t%ld\t%lld\n", (unsigned long)curfile.ino, volno, curtapepos);
+                               if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps))
+                                       warn("error writing tapepos file.\n");
+                               skipfile();
+                       }
+                       else {
+                               msg("restoring %s\n", myname(ep));
+#endif /* USE_QFA */
+                               (void) extractfile(myname(ep));
+#ifdef USE_QFA
+                       }
+#endif /* USE_QFA */
                        ep->e_flags &= ~NEW;
                        if (volno != curvol)
                                skipmaps();
index a9dba7bfb539530da14453bd4513882459faf5fa..572a1bcea342bae68fd00a6c3000755a0316c9a7 100644 (file)
@@ -5,7 +5,7 @@
  *     Stelian Pop <stelian@popies.net>, 1999-2000
  *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
  *
- *     $Id: restore.h,v 1.24 2002/01/25 14:59:53 stelian Exp $
+ *     $Id: restore.h,v 1.25 2002/02/04 11:18:46 stelian Exp $
  */
 
 /*
@@ -135,7 +135,7 @@ struct entry {
 struct context {
        char    *name;          /* name of file */
        dump_ino_t ino;         /* inumber of file */
-#ifdef __linux__
+#if defined(__linux__) || defined(sunos)
        struct  new_bsd_inode *dip;     /* pointer to inode */
 #else
        struct  dinode *dip;    /* pointer to inode */
@@ -179,6 +179,10 @@ extern char        *gTapeposfile;
 extern char    gTps[255];
 extern long    gSeekstart;
 extern int     tapeposflag;
+extern int     gTapeposfd;
+extern int     createtapeposflag;
+extern unsigned long qfadumpdate;
+extern long long curtapepos;
 #endif /* USE_QFA */
 
 #define do_compare_error \
index 94ceab46fdfa9a706cac851acb3108936dd05fcf..b6d27f7a691060a9656337bcab4c1e6ca6da353c 100644 (file)
@@ -46,7 +46,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.57 2002/01/31 10:25:55 stelian Exp $";
+       "$Id: tape.c,v 1.58 2002/02/04 11:18:46 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -332,6 +332,10 @@ setup(void)
        }
        if (vflag || command == 't' || command == 'C')
                printdumpinfo();
+#ifdef USE_QFA
+       if (tapeposflag && spcl.c_date != qfadumpdate)
+               errx(1, "different QFA/dumpdates detected\n");
+#endif
        if (filesys[0] == '\0') {
                char *dirptr;
                strncpy(filesys, spcl.c_filesys, NAMELEN);
@@ -416,6 +420,10 @@ getvol(long nextvol)
        }
        saved_blksread = blksread;
        saved_tpblksread = tpblksread;
+#if defined(USE_QFA) && defined(sunos)
+       if (createtapeposflag || tapeposflag) 
+               close(fdsmtc);
+#endif
 again:
        if (pipein)
                exit(1); /* pipes do not get a second chance */
@@ -429,7 +437,7 @@ again:
        while (newvol <= 0) {
                if (tapesread == 0) {
                        fprintf(stderr, "%s%s%s%s%s",
-                           "You have not read any tapes yet.\n",
+                           "You have not read any volumes yet.\n",
                            "Unless you know which volume your",
                            " file(s) are on you should start\n",
                            "with the last volume and work",
@@ -463,6 +471,15 @@ again:
        }
        if (newvol == volno) {
                tapesread |= 1 << volno;
+#if defined(USE_QFA) && defined(sunos)
+               if (createtapeposflag || tapeposflag) {
+                       if (OpenSMTCmt(magtape) < 0) {
+                               volno = -1;
+                               haderror = 1;
+                               goto again;
+                       }
+               }
+#endif
                return;
        }
        closemt();
@@ -480,9 +497,9 @@ again:
        }
        if (haderror || (bot_code && !Mflag)) {
                haderror = 0;
-               fprintf(stderr, "Mount tape volume %ld\n", (long)newvol);
-               fprintf(stderr, "Enter ``none'' if there are no more tapes\n");
-               fprintf(stderr, "otherwise enter tape name (default: %s) ", magtape);
+               fprintf(stderr, "Mount volume %ld\n", (long)newvol);
+               fprintf(stderr, "Enter ``none'' if there are no more volumes\n");
+               fprintf(stderr, "otherwise enter volume name (default: %s) ", magtape);
                (void) fflush(stderr);
                (void) fgets(buf, TP_BSIZE, terminal);
                if (feof(terminal))
@@ -672,6 +689,13 @@ printvolinfo(void)
        }
 }
 
+#ifdef sunos
+struct timeval
+       time_t          tv_sec;         /* seconds */
+       suseconds_t     tv_usec;        /* and microseconds */
+};
+#endif
+
 int
 extractfile(char *name)
 {
@@ -682,12 +706,12 @@ extractfile(char *name)
 
        curfile.name = name;
        curfile.action = USING;
-#ifdef __linux__
+#if defined(__linux__) || defined(sunos)
        timep[0].tv_sec = curfile.dip->di_atime.tv_sec;
        timep[0].tv_usec = curfile.dip->di_atime.tv_usec;
        timep[1].tv_sec = curfile.dip->di_mtime.tv_sec;
        timep[1].tv_usec = curfile.dip->di_mtime.tv_usec;
-#else  /* __linux__ */
+#else  /* __linux__ || sunos */
        timep[0].tv_sec = curfile.dip->di_atime;
        timep[0].tv_usec = curfile.dip->di_atimensec / 1000;
        timep[1].tv_sec = curfile.dip->di_mtime;
@@ -907,7 +931,7 @@ loop:
                        curfile.name, (long)blksread);
        }
        if (curblk > 0) {
-               (*fill)((char *)buf, (size_t)(curblk * TP_BSIZE) + size);
+               (*fill)((char *)buf, (size_t)((curblk * TP_BSIZE) + size));
                last_write_was_hole = 0;
        }
        if (size > 0) {
@@ -1400,6 +1424,10 @@ readtape(char *buf)
                numtrec = ntrec;
        cnt = ntrec * TP_BSIZE;
        rd = 0;
+#ifdef USE_QFA
+       if (createtapeposflag)
+               (void)GetTapePos(&curtapepos);
+#endif
 getmore:
 #ifdef RRESTORE
        if (host)
@@ -2052,15 +2080,15 @@ gethead(struct s_spcl *buf)
        buf->c_dinode.di_gid = u_ospcl.s_ospcl.c_dinode.odi_gid;
        buf->c_dinode.di_size = u_ospcl.s_ospcl.c_dinode.odi_size;
        buf->c_dinode.di_rdev = u_ospcl.s_ospcl.c_dinode.odi_rdev;
-#ifdef __linux__
+#if defined(__linux__) || defined(sunos)
        buf->c_dinode.di_atime.tv_sec = u_ospcl.s_ospcl.c_dinode.odi_atime;
        buf->c_dinode.di_mtime.tv_sec = u_ospcl.s_ospcl.c_dinode.odi_mtime;
        buf->c_dinode.di_ctime.tv_sec = u_ospcl.s_ospcl.c_dinode.odi_ctime;
-#else  /* __linux__ */
+#else  /* __linux__ || sunos */
        buf->c_dinode.di_atime = u_ospcl.s_ospcl.c_dinode.odi_atime;
        buf->c_dinode.di_mtime = u_ospcl.s_ospcl.c_dinode.odi_mtime;
        buf->c_dinode.di_ctime = u_ospcl.s_ospcl.c_dinode.odi_ctime;
-#endif /* __linux__ */
+#endif /* __linux__ || sunos */
        buf->c_count = u_ospcl.s_ospcl.c_count;
        memmove(buf->c_addr, u_ospcl.s_ospcl.c_fill, (long)256);
        if (u_ospcl.s_ospcl.c_magic != OFS_MAGIC ||
@@ -2073,7 +2101,7 @@ good:
            (buf->c_dinode.di_mode & IFMT) == IFDIR && Qcvt == 0) {
                qcvt.qval = buf->c_dinode.di_size;
                if (qcvt.val[0] || qcvt.val[1]) {
-                       printf("Note: Doing Quad swapping\n");
+                       Vprintf(stdout, "Note: Doing Quad swapping\n");
                        Qcvt = 1;
                }
        }
@@ -2507,6 +2535,29 @@ ReReadFromTape(void)
        findinode(&spcl);
        noresyncmesg = 0;
 }
+
+void
+ReReadInodeFromTape(dump_ino_t theino)
+{
+       long cntloop = 0;
+
+       FLUSHTAPEBUF();
+       noresyncmesg = 1;
+       do {
+               cntloop++;
+               gethead(&spcl);
+       } while (!(spcl.c_inumber == theino && spcl.c_type == TS_INODE && spcl.c_date == dumpdate) && (cntloop < 32));
+#ifdef DEBUG_QFA
+       fprintf(stderr, "%ld reads\n", cntloop);
+       if (cntloop == 32) {
+               fprintf(stderr, "DEBUG: bufsize %d\n", bufsize);
+               fprintf(stderr, "DEBUG: ntrec %ld\n", ntrec);
+               fprintf(stderr, "DEBUG: %ld reads\n", cntloop);
+       }
+#endif
+       findinode(&spcl);
+       noresyncmesg = 0;
+}
 #endif /* USE_QFA */
 
 void
index 627e147875ee44d5454aa4f8810f8462e852ed97..e897344a1e0a85ef5bec3d5f0bdb9aee51fae362 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: utilities.c,v 1.19 2002/01/25 15:09:00 stelian Exp $";
+       "$Id: utilities.c,v 1.20 2002/02/04 11:18:46 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -236,7 +236,7 @@ linkit(char *existing, char *new, int type)
 
                if (!Nflag && (ret = link(existing, new)) < 0) {
 
-#ifndef __linux__
+#if !defined(__linux__) && !defined(sunos)
                        struct stat s;
 
                        /*
@@ -276,7 +276,7 @@ linkit(char *existing, char *new, int type)
        return (GOOD);
 }
 
-#ifndef        __linux__
+#if !defined(__linux__) && !defined(sunos)
 /*
  * Create a whiteout.
  */