new copyright notice
[unix-history] / usr / src / sbin / restore / symtab.c
index 33da3d9..ca1bbab 100644 (file)
@@ -1,8 +1,13 @@
-/* Copyright (c) 1983 Regents of the University of California */
+/*
+ * Copyright (c) 1983 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ */
 
 #ifndef lint
 
 #ifndef lint
-static char sccsid[] = "@(#)symtab.c   3.13    (Berkeley)      83/07/01";
-#endif
+static char sccsid[] = "@(#)symtab.c   5.5 (Berkeley) %G%";
+#endif /* not lint */
 
 /*
  * These routines maintain the symbol table which tracks the state
 
 /*
  * These routines maintain the symbol table which tracks the state
@@ -15,7 +20,7 @@ static char sccsid[] = "@(#)symtab.c  3.13    (Berkeley)      83/07/01";
 
 #include "restore.h"
 #include <sys/stat.h>
 
 #include "restore.h"
 #include <sys/stat.h>
-#include <sys/dir.h>
+#include <ufs/dir.h>
 
 /*
  * The following variables define the inode symbol table.
 
 /*
  * The following variables define the inode symbol table.
@@ -184,6 +189,8 @@ addentry(name, inum, type)
                bzero((char *)np, (long)sizeof(struct entry));
        } else {
                np = (struct entry *)calloc(1, sizeof(struct entry));
                bzero((char *)np, (long)sizeof(struct entry));
        } else {
                np = (struct entry *)calloc(1, sizeof(struct entry));
+               if (np == NIL)
+                       panic("no memory to extend symbol table\n");
        }
        np->e_type = type & ~LINK;
        ep = lookupparent(name);
        }
        np->e_type = type & ~LINK;
        ep = lookupparent(name);
@@ -385,6 +392,7 @@ struct symtableheader {
        time_t  dumptime;
        time_t  dumpdate;
        ino_t   maxino;
        time_t  dumptime;
        time_t  dumpdate;
        ino_t   maxino;
+       long    ntrec;
 };
 
 /*
 };
 
 /*
@@ -402,6 +410,8 @@ dumpsymtable(filename, checkpt)
        struct symtableheader hdr;
 
        vprintf(stdout, "Check pointing the restore\n");
        struct symtableheader hdr;
 
        vprintf(stdout, "Check pointing the restore\n");
+       if (Nflag)
+               return;
        if ((fd = fopen(filename, "w")) == NULL) {
                perror("fopen");
                panic("cannot create save file %s for symbol table\n",
        if ((fd = fopen(filename, "w")) == NULL) {
                perror("fopen");
                panic("cannot create save file %s for symbol table\n",
@@ -462,6 +472,7 @@ dumpsymtable(filename, checkpt)
        hdr.stringsize = stroff;
        hdr.dumptime = dumptime;
        hdr.dumpdate = dumpdate;
        hdr.stringsize = stroff;
        hdr.dumptime = dumptime;
        hdr.dumpdate = dumpdate;
+       hdr.ntrec = ntrec;
        (void) fwrite((char *)&hdr, sizeof(struct symtableheader), 1, fd);
        if (ferror(fd)) {
                perror("fwrite");
        (void) fwrite((char *)&hdr, sizeof(struct symtableheader), 1, fd);
        if (ferror(fd)) {
                perror("fwrite");
@@ -535,6 +546,8 @@ initsymtable(filename)
                curfile.action = SKIP;
                dumptime = hdr.dumptime;
                dumpdate = hdr.dumpdate;
                curfile.action = SKIP;
                dumptime = hdr.dumptime;
                dumpdate = hdr.dumpdate;
+               if (!bflag)
+                       newtapebuf(hdr.ntrec);
                getvol(hdr.volno);
                break;
        default:
                getvol(hdr.volno);
                break;
        default: