From: Kirk McKusick Date: Sun, 8 Nov 1981 06:56:16 +0000 (-0800) Subject: dump to "standard" (ie 1K file system) dump tapes X-Git-Tag: BSD-4_1_snap-Snapshot-Development~586 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/f5bba47335f47a8a71e256728b36f6b8d76b8913 dump to "standard" (ie 1K file system) dump tapes SCCS-vsn: sbin/dump/dump.h 1.3 SCCS-vsn: sbin/dump/itime.c 1.3 SCCS-vsn: sbin/dump/main.c 1.4 SCCS-vsn: sbin/dump/tape.c 1.4 SCCS-vsn: sbin/dump/traverse.c 1.3 SCCS-vsn: sbin/dump/traverse.c 1.3 SCCS-vsn: include/protocols/dumprestore.h 1.2 --- diff --git a/usr/src/include/protocols/dumprestore.h b/usr/src/include/protocols/dumprestore.h index 100be0dce1..3c2b7115cd 100644 --- a/usr/src/include/protocols/dumprestore.h +++ b/usr/src/include/protocols/dumprestore.h @@ -1,10 +1,13 @@ /* Copyright (c) 1981 Regents of the University of California */ -/* "@(#)dumprestore.h 1.1 %G%" */ +/* "@(#)dumprestore.h 1.2 %G%" */ +#define TP_BSIZE 1024 #define NTREC 10 #define MLEN 16 #define MSIZ 4096 +#define BLKING (FSIZE/TP_BSIZE) +#define TP_NINDIR (TP_BSIZE/2) #define TS_TAPE 1 #define TS_INODE 2 @@ -15,19 +18,24 @@ #define MAGIC (int)60011 #define CHECKSUM (int)84446 -struct spcl { - int c_type; - time_t c_date; - time_t c_ddate; - int c_volume; - daddr_t c_tapea; - ino_t c_inumber; - int c_magic; - int c_checksum; - struct dinode c_dinode; - int c_count; - char c_addr[BSIZE]; -} spcl; +union u_spcl { + char dummy[TP_BSIZE]; + struct s_spcl { + int c_type; + time_t c_date; + time_t c_ddate; + int c_volume; + daddr_t c_tapea; + ino_t c_inumber; + int c_magic; + int c_checksum; + struct dinode c_dinode; + int c_count; + char c_addr[TP_NINDIR]; + } s_spcl; +} u_spcl; + +#define spcl u_spcl.s_spcl struct idates { char id_name[16]; diff --git a/usr/src/sbin/dump/dump.h b/usr/src/sbin/dump/dump.h index 2f5711588e..9f387552ca 100644 --- a/usr/src/sbin/dump/dump.h +++ b/usr/src/sbin/dump/dump.h @@ -1,5 +1,5 @@ /* - * "@(#)dump.h 1.2 (Berkeley) %G%" + * "@(#)dump.h 1.3 (Berkeley) %G%" */ #define NI 16 #define DIRPB (BSIZE/sizeof(struct direct)) @@ -11,11 +11,11 @@ #include "../../h/fs.h" #include "../../h/inode.h" #include "../../h/dir.h" +#include "../../h/dumprestor.h" #include #include #include int (*signal())(); -#include #include #define MWORD(m,i) (m[(unsigned)(i-1)/MLEN]) diff --git a/usr/src/sbin/dump/itime.c b/usr/src/sbin/dump/itime.c index 28e889e4fc..bc4bd9d041 100644 --- a/usr/src/sbin/dump/itime.c +++ b/usr/src/sbin/dump/itime.c @@ -1,4 +1,4 @@ -static char *sccsid = "@(#)itime.c 1.2 (Berkeley) %G%"; +static char *sccsid = "@(#)itime.c 1.3 (Berkeley) %G%"; #include "dump.h" char *prdate(d) @@ -220,14 +220,15 @@ est(ip) long s; esize++; - s = (ip->di_size + BSIZE-1) / BSIZE; + s = (ip->di_size + FSIZE-1) / FSIZE; esize += s; + s /= FRAG; if (s > NDADDR) { s -= NDADDR; if (s > BSIZE / sizeof(daddr_t)) esize++; s = (s + (BSIZE/sizeof(daddr_t)) - 1) / (BSIZE/sizeof(daddr_t)); - esize += s; + esize += s * FRAG; } } @@ -243,5 +244,5 @@ short *map; if(n < 0) return; esize++; - esize += (n + (BSIZE/sizeof(short))-1) / (BSIZE/sizeof(short)); + esize += (n + (BSIZE/sizeof(short))-1) / (BSIZE/sizeof(short)) * FRAG; } diff --git a/usr/src/sbin/dump/main.c b/usr/src/sbin/dump/main.c index fdcb51d509..69c2bd1ae1 100644 --- a/usr/src/sbin/dump/main.c +++ b/usr/src/sbin/dump/main.c @@ -1,4 +1,4 @@ -static char *sccsid = "@(#)main.c 1.3 (Berkeley) %G%"; +static char *sccsid = "@(#)main.c 1.4 (Berkeley) %G%"; #include "dump.h" int notify = 0; /* notify operator flag */ @@ -165,7 +165,7 @@ main(argc, argv) fetapes = ( esize /* blocks */ - *BSIZE /* bytes / block */ + *FSIZE /* bytes / block */ *(1.0/density) /* 0.1" / byte */ + esize /* blocks */ diff --git a/usr/src/sbin/dump/tape.c b/usr/src/sbin/dump/tape.c index 6042d61098..dd5565f7c8 100644 --- a/usr/src/sbin/dump/tape.c +++ b/usr/src/sbin/dump/tape.c @@ -1,33 +1,43 @@ -static char *sccsid = "@(#)tape.c 1.3 (Berkeley) %G%"; +static char *sccsid = "@(#)tape.c 1.4 (Berkeley) %G%"; #include "dump.h" -char tblock[NTREC][BSIZE]; -daddr_t tdaddr[NTREC]; -int trecno; +char tblock[NTREC][TP_BSIZE]; +int trecno = 0; taprec(dp) char *dp; { register i; - for(i=0; i= NTREC) flusht(); } -tapsrec(d) -daddr_t d; +dmpblk(blkno, size) + daddr_t blkno; + int size; { + int avail, blks; - if(d == 0) - return; - tdaddr[trecno] = d; - trecno++; - spcl.c_tapea++; + if (size % FRAG != 0) + msg("bad size to dmpblk: %d\n", size); + avail = NTREC - trecno; + for (blks = size / TP_BSIZE; blks > avail; ) { + bread(blkno, tblock[trecno], TP_BSIZE * avail); + trecno += avail; + spcl.c_tapea += avail; + flusht(); + blkno += avail; + blks -= avail; + avail = NTREC - trecno; + } + bread(blkno, tblock[trecno], TP_BSIZE * blks); + trecno += blks; + spcl.c_tapea += blks; if(trecno >= NTREC) flusht(); } @@ -39,22 +49,6 @@ flusht() register i, si; daddr_t d; - while(trecno < NTREC) - tdaddr[trecno++] = 1; - -loop: - d = 0; - for(i=0; i