Changes from Kirk McKusick
authorPeter Collinson <pc@ucbvax.Berkeley.EDU>
Wed, 5 Aug 1987 04:52:24 +0000 (20:52 -0800)
committerPeter Collinson <pc@ucbvax.Berkeley.EDU>
Wed, 5 Aug 1987 04:52:24 +0000 (20:52 -0800)
SCCS-vsn: local/ukc/dump/dumpmain.c 1.2
SCCS-vsn: local/ukc/dump/dumptape.c 1.2

usr/src/local/ukc/dump/dumpmain.c
usr/src/local/ukc/dump/dumptape.c

index 756716e..367b944 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)dumpmain.c 5.4 (Berkeley) 5/28/86";
+static char sccsid[] = "@(#)dumpmain.c 5.6 (Berkeley) 2/23/87";
 #endif not lint
 
 #include "dump.h"
 #endif not lint
 
 #include "dump.h"
@@ -191,8 +191,18 @@ main(argc, argv)
         *      the file system name with or without the leading '/'.
         */
        dt = fstabsearch(disk);
         *      the file system name with or without the leading '/'.
         */
        dt = fstabsearch(disk);
-       if (dt != 0)
+       if (dt != 0) {
                disk = rawname(dt->fs_spec);
                disk = rawname(dt->fs_spec);
+               strncpy(spcl.c_dev, dt->fs_spec, NAMELEN);
+               strncpy(spcl.c_filesys, dt->fs_file, NAMELEN);
+       } else {
+               strncpy(spcl.c_dev, disk, NAMELEN);
+               strncpy(spcl.c_filesys, "an unlisted file system", NAMELEN);
+       }
+       strcpy(spcl.c_label, "none");
+       gethostname(spcl.c_host, NAMELEN);
+       spcl.c_level = incno - '0';
+       spcl.c_type = TS_TAPE;
        getitime();             /* /etc/dumpdates snarfed */
 
        msg("Date of this level %c dump: %s\n", incno, prdate(spcl.c_date));
        getitime();             /* /etc/dumpdates snarfed */
 
        msg("Date of this level %c dump: %s\n", incno, prdate(spcl.c_date));
index 3031785..49e1d16 100644 (file)
@@ -5,15 +5,16 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)dumptape.c 5.5 (Berkeley) 5/23/86";
+static char sccsid[] = "@(#)dumptape.c 5.8 (Berkeley) 2/23/87";
 #endif not lint
 
 #include <sys/file.h>
 #include "dump.h"
 
 #endif not lint
 
 #include <sys/file.h>
 #include "dump.h"
 
-char   (*tblock)[TP_BSIZE];    /* Pointer to malloc()ed buffer for tape */
-int    writesize;              /* Size of malloc()ed buffer for tape */
-int    trecno = 0;
+char   (*tblock)[TP_BSIZE];    /* pointer to malloc()ed buffer for tape */
+int    writesize;              /* size of malloc()ed buffer for tape */
+long   lastspclrec = -1;       /* tape block number of last written header */
+int    trecno = 0;             /* next record to write in current block */
 extern int ntrec;              /* blocking factor on tape */
 extern int cartridge;
 extern int read(), write();
 extern int ntrec;              /* blocking factor on tape */
 extern int cartridge;
 extern int read(), write();
@@ -74,6 +75,7 @@ taprec(dp)
        req[trecno].dblk = (daddr_t)0;
        req[trecno].count = 1;
        *(union u_spcl *)(*tblock++) = *(union u_spcl *)dp;     /* movc3 */
        req[trecno].dblk = (daddr_t)0;
        req[trecno].count = 1;
        *(union u_spcl *)(*tblock++) = *(union u_spcl *)dp;     /* movc3 */
+       lastspclrec = spcl.c_tapea;
        trecno++;
        spcl.c_tapea++;
        if(trecno >= ntrec)
        trecno++;
        spcl.c_tapea++;
        if(trecno >= ntrec)
@@ -218,6 +220,7 @@ otape()
        int     status;
        int     waitpid;
        int     (*interrupt)() = signal(SIGINT, SIG_IGN);
        int     status;
        int     waitpid;
        int     (*interrupt)() = signal(SIGINT, SIG_IGN);
+       int     blks, i;
 
        parentpid = getpid();
 
 
        parentpid = getpid();
 
@@ -300,9 +303,17 @@ otape()
                asize = 0;
                tapeno++;               /* current tape sequence */
                newtape++;              /* new tape signal */
                asize = 0;
                tapeno++;               /* current tape sequence */
                newtape++;              /* new tape signal */
+               blks = 0;
+               if (spcl.c_type != TS_END)
+                       for (i = 0; i < spcl.c_count; i++)
+                               if (spcl.c_addr[i] != 0)
+                                       blks++;
+               spcl.c_count = blks + 1 - spcl.c_tapea + lastspclrec;
                spcl.c_volume++;
                spcl.c_type = TS_TAPE;
                spcl.c_volume++;
                spcl.c_type = TS_TAPE;
+               spcl.c_flags |= DR_NEWHEADER;
                spclrec();
                spclrec();
+               spcl.c_flags &=~ DR_NEWHEADER;
                if (tapeno > 1)
                        msg("Tape %d begins with blocks from ino %d\n",
                                tapeno, ino);
                if (tapeno > 1)
                        msg("Tape %d begins with blocks from ino %d\n",
                                tapeno, ino);