dpz@pilot.njin.net (David P. Zimmerman) (08/30/88)
[ Mailers give me headaches. Big ones. About {--yo--} big. ] I've gotten a number of requests for my patches to dump and restore to allow reading and writing of 4.3BSD format dump tapes on Suns, Pyramids, and Celerities. Problem is that I can't get back to some of the people. So, here's my diffs to the stock 4.3BSD dump and restore. Note that I don't have Dave Curry's live dump mods in this - I decided against using them when people started screaming about not being able to restore some log files.... I suppose that with a bit of work one could implement an exceptions list or something to dump particular 'changing' files. David #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: dump dump/Makefile.PYRAMID.diff dump/Makefile.SUNOS4.diff # dump/Makefile.diff dump/README dump/dump.5.diff dump/dump.h.diff # dump/dumprestore.h.diff dump/dumprmt.c.diff # dump/dumptraverse.c.diff restore restore/Makefile.SUNOS4.diff # restore/Makefile.diff restore/README restore/dirs.c.diff # restore/dumprestore.h.diff restore/interactive.c.diff # restore/main.c.diff restore/opendir.c restore/restore.h.diff # restore/tape.c.diff restore/telldir.c # Wrapped by dpz@pilot.njin.net on Wed Aug 17 22:03:32 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test ! -d dump ; then echo shar: Creating directory \"dump\" mkdir dump fi if test -f dump/Makefile.PYRAMID.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump/Makefile.PYRAMID.diff\" else echo shar: Extracting \"dump/Makefile.PYRAMID.diff\" \(957 characters\) sed "s/^X//" >dump/Makefile.PYRAMID.diff <<'END_OF_dump/Makefile.PYRAMID.diff' X*** Makefile.ORIG Sat Jan 9 16:27:00 1988 X--- Makefile.PYRAMID Tue Mar 1 17:11:01 1988 X*************** X*** 31,37 **** X ROBJS = dumpitime.o dumprmain.o dumpoptr.o \ X dumprmt.o dumprtape.o dumptraverse.o unctime.o X X! DFLAGS = X CFLAGS = -O $(DFLAGS) X X all: dump rdump X--- 31,37 ---- X ROBJS = dumpitime.o dumprmain.o dumpoptr.o \ X dumprmt.o dumprtape.o dumptraverse.o unctime.o X X! DFLAGS = -DPYRAMID X CFLAGS = -O $(DFLAGS) X X all: dump rdump X*************** X*** 66,70 **** X pr $(PSRCS) | lpr X X $(OBJS): dump.h /usr/include/sys/param.h X! $(OBJS): /usr/include/sys/fs.h /usr/include/sys/inode.h X $(OBJS): /usr/include/protocols/dumprestore.h /usr/include/sys/stat.h X--- 66,71 ---- X pr $(PSRCS) | lpr X X $(OBJS): dump.h /usr/include/sys/param.h X! $(OBJS): /usr/include/ufs/fs.h /usr/include/ufs/inode.h X! $(OBJS): /usr/include/sys/time.h /usr/include/sys/vnode.h X $(OBJS): /usr/include/protocols/dumprestore.h /usr/include/sys/stat.h END_OF_dump/Makefile.PYRAMID.diff if test 957 -ne `wc -c <dump/Makefile.PYRAMID.diff`; then echo shar: \"dump/Makefile.PYRAMID.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f dump/Makefile.SUNOS4.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump/Makefile.SUNOS4.diff\" else echo shar: Extracting \"dump/Makefile.SUNOS4.diff\" \(1347 characters\) sed "s/^X//" >dump/Makefile.SUNOS4.diff <<'END_OF_dump/Makefile.SUNOS4.diff' X*** Makefile.ORIG Sat Jan 9 16:27:00 1988 X--- Makefile.SUNOS4 Mon Jul 4 01:56:40 1988 X*************** X*** 31,46 **** X ROBJS = dumpitime.o dumprmain.o dumpoptr.o \ X dumprmt.o dumprtape.o dumptraverse.o unctime.o X X! DFLAGS = X CFLAGS = -O $(DFLAGS) X X all: dump rdump X X rdump: $(ROBJS) X! $(CC) $(CFLAGS) $(ROBJS) -o rdump X X dump: $(OBJS) X! $(CC) $(CFLAGS) $(OBJS) -o dump X X install: rdump dump X install -s -m 6755 -g tty rdump $(DESTDIR)/etc X--- 31,46 ---- X ROBJS = dumpitime.o dumprmain.o dumpoptr.o \ X dumprmt.o dumprtape.o dumptraverse.o unctime.o X X! DFLAGS = -DSUNOS4 X CFLAGS = -O $(DFLAGS) X X all: dump rdump X X rdump: $(ROBJS) X! $(CC) $(CFLAGS) $(ROBJS) -Bstatic -o rdump X X dump: $(OBJS) X! $(CC) $(CFLAGS) $(OBJS) -Bstatic -o dump X X install: rdump dump X install -s -m 6755 -g tty rdump $(DESTDIR)/etc X*************** X*** 66,70 **** X pr $(PSRCS) | lpr X X $(OBJS): dump.h /usr/include/sys/param.h X! $(OBJS): /usr/include/sys/fs.h /usr/include/sys/inode.h X $(OBJS): /usr/include/protocols/dumprestore.h /usr/include/sys/stat.h X--- 66,71 ---- X pr $(PSRCS) | lpr X X $(OBJS): dump.h /usr/include/sys/param.h X! $(OBJS): /usr/include/ufs/fs.h /usr/include/ufs/inode.h X! $(OBJS): /usr/include/sys/time.h /usr/include/sys/vnode.h X $(OBJS): /usr/include/protocols/dumprestore.h /usr/include/sys/stat.h END_OF_dump/Makefile.SUNOS4.diff if test 1347 -ne `wc -c <dump/Makefile.SUNOS4.diff`; then echo shar: \"dump/Makefile.SUNOS4.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f dump/Makefile.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump/Makefile.diff\" else echo shar: Extracting \"dump/Makefile.diff\" \(581 characters\) sed "s/^X//" >dump/Makefile.diff <<'END_OF_dump/Makefile.diff' X*** Makefile.ORIG Sat Jan 9 16:27:00 1988 X--- Makefile Sat Jan 9 16:29:32 1988 X*************** X*** 66,70 **** X pr $(PSRCS) | lpr X X $(OBJS): dump.h /usr/include/sys/param.h X! $(OBJS): /usr/include/sys/fs.h /usr/include/sys/inode.h X $(OBJS): /usr/include/protocols/dumprestore.h /usr/include/sys/stat.h X--- 66,71 ---- X pr $(PSRCS) | lpr X X $(OBJS): dump.h /usr/include/sys/param.h X! $(OBJS): /usr/include/ufs/fs.h /usr/include/ufs/inode.h X! $(OBJS): /usr/include/sys/time.h /usr/include/sys/vnode.h X $(OBJS): /usr/include/protocols/dumprestore.h /usr/include/sys/stat.h END_OF_dump/Makefile.diff if test 581 -ne `wc -c <dump/Makefile.diff`; then echo shar: \"dump/Makefile.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f dump/README -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump/README\" else echo shar: Extracting \"dump/README\" \(1054 characters\) sed "s/^X//" >dump/README <<'END_OF_dump/README' Xdpz's changes to the standard 4.3BSD dump for compatible Sun SunOS X3.x, Sun SunOS 4.0, Pyramid OSx4.1, and Celerity 3.4 dumps: X X - nuking setsockopt in dumprmt.c X - replacing various #include files with equivalents X X - compile on Pyramid with -DPYRAMID in Makefile X - adding code to dump a Pyramid symbolic link out in standard X 4.3 style (on a Pyramid, the text of the link resides within X the inode's direct block pointer area; in 4.3, the text of X the link is held in disk blocks) X X - compile on Sun SunOS 4.0 with -DSUNOS4 in Makefile, and link X statically X - generalizing "struct direct" to a typedef, since SunOS 4.0 X has a field in it that doesn't exist on disk X X - adding/modifying /usr/include/protocols/dumprestore.h: X - to have TP_BSIZE equal the largest disk block size X across all three architectures (2048 in this case) X - adjusting NTREC and HIGHDENSITYTREC down to balance X my higher TP_BSIZE X - adjusting DUMPOUTFMT and DUMPINFMT to have the same X (highest) number for %XXs X - adding CARTRIDGETREC for some reason END_OF_dump/README if test 1054 -ne `wc -c <dump/README`; then echo shar: \"dump/README\" unpacked with wrong size! fi # end of overwriting check fi if test -f dump/dump.5.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump/dump.5.diff\" else echo shar: Extracting \"dump/dump.5.diff\" \(856 characters\) sed "s/^X//" >dump/dump.5.diff <<'END_OF_dump/dump.5.diff' X*** dump.5.ORIG Sat Jan 9 19:07:11 1988 X--- dump.5 Sun Jul 3 23:09:10 1988 X*************** X*** 35,41 **** X is: X .PP X .nf X! #define NTREC 10 X #define MLEN 16 X #define MSIZ 4096 X X--- 35,41 ---- X is: X .PP X .nf X! #define NTREC 5 X #define MLEN 16 X #define MSIZ 4096 X X*************** X*** 68,76 **** X time_t id_ddate; X }; X X! #define DUMPOUTFMT "%-16s %c %s" /* for printf */ X /* name, incno, ctime(date) */ X! #define DUMPINFMT "%16s %c %[^\en]\en" /* inverse for scanf */ X .fi X .PP X NTREC is the number of 1024 byte records in a physical X--- 68,76 ---- X time_t id_ddate; X }; X X! #define DUMPOUTFMT "%-22s %c %s" /* for printf */ X /* name, incno, ctime(date) */ X! #define DUMPINFMT "%22s %c %[^\en]\en" /* inverse for scanf */ X .fi X .PP X NTREC is the number of 1024 byte records in a physical END_OF_dump/dump.5.diff if test 856 -ne `wc -c <dump/dump.5.diff`; then echo shar: \"dump/dump.5.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f dump/dump.h.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump/dump.h.diff\" else echo shar: Extracting \"dump/dump.h.diff\" \(1009 characters\) sed "s/^X//" >dump/dump.h.diff <<'END_OF_dump/dump.h.diff' X*** dump.h.ORIG Sat Jan 9 16:27:01 1988 X--- dump.h Tue Jul 12 16:52:56 1988 X*************** X*** 14,25 **** X #include <ctype.h> X #include <sys/param.h> X #include <sys/stat.h> X! #include <sys/fs.h> X! #include <sys/inode.h> X #include <protocols/dumprestore.h> X #include <sys/dir.h> X #include <utmp.h> X- #include <sys/time.h> X #include <signal.h> X #include <fstab.h> X X--- 14,38 ---- X #include <ctype.h> X #include <sys/param.h> X #include <sys/stat.h> X! #include <ufs/fs.h> X! #include <sys/time.h> X! #include <sys/vnode.h> X! #include <ufs/inode.h> X #include <protocols/dumprestore.h> X #include <sys/dir.h> X+ X+ #ifdef SUNOS4 X+ typedef struct { X+ u_long d_fileno; /* file number of entry */ X+ u_short d_reclen; /* length of this record */ X+ u_short d_namlen; /* length of string in d_name */ X+ char d_name[MAXNAMLEN + 1]; /* name (up to MAXNAMLEN + 1) */ X+ } UNIXDIRECT; X+ #else X+ typedef struct direct UNIXDIRECT; X+ #endif X+ X #include <utmp.h> X #include <signal.h> X #include <fstab.h> X END_OF_dump/dump.h.diff if test 1009 -ne `wc -c <dump/dump.h.diff`; then echo shar: \"dump/dump.h.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f dump/dumprestore.h.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump/dumprestore.h.diff\" else echo shar: Extracting \"dump/dumprestore.h.diff\" \(1680 characters\) sed "s/^X//" >dump/dumprestore.h.diff <<'END_OF_dump/dumprestore.h.diff' X*** dumprestore.h.ORIG Mon Apr 18 21:32:40 1988 X--- dumprestore.h Fri Jun 10 21:53:09 1988 X*************** X*** 13,26 **** X * NTREC is the number of TP_BSIZE blocks that are written X * in each tape record. HIGHDENSITYTREC is the number of X * TP_BSIZE blocks that are written in each tape record on X! * 6250 BPI or higher density tapes. X * X * TP_NINDIR is the number of indirect pointers in a TS_INODE X * or TS_ADDR record. Note that it must be a power of two. X */ X! #define TP_BSIZE 1024 X! #define NTREC 10 X! #define HIGHDENSITYTREC 32 X #define TP_NINDIR (TP_BSIZE/2) X X #define TS_TAPE 1 X--- 13,29 ---- X * NTREC is the number of TP_BSIZE blocks that are written X * in each tape record. HIGHDENSITYTREC is the number of X * TP_BSIZE blocks that are written in each tape record on X! * 6250 BPI or higher density tapes. CARTRIDGETREC is the X! * number of TP_BSIZE blocks that are written in each tape X! * record on cartridge tapes. X * X * TP_NINDIR is the number of indirect pointers in a TS_INODE X * or TS_ADDR record. Note that it must be a power of two. X */ X! #define TP_BSIZE 2048 X! #define NTREC 5 X! #define HIGHDENSITYTREC 16 X! #define CARTRIDGETREC 31 X #define TP_NINDIR (TP_BSIZE/2) X X #define TS_TAPE 1 X*************** X*** 52,57 **** X X #define spcl u_spcl.s_spcl X X! #define DUMPOUTFMT "%-16s %c %s" /* for printf */ X /* name, incno, ctime(date) */ X! #define DUMPINFMT "%16s %c %[^\n]\n" /* inverse for scanf */ X--- 55,60 ---- X X #define spcl u_spcl.s_spcl X X! #define DUMPOUTFMT "%-22s %c %s" /* for printf */ X /* name, incno, ctime(date) */ X! #define DUMPINFMT "%22s %c %[^\n]\n" /* inverse for scanf */ END_OF_dump/dumprestore.h.diff if test 1680 -ne `wc -c <dump/dumprestore.h.diff`; then echo shar: \"dump/dumprestore.h.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f dump/dumprmt.c.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump/dumprmt.c.diff\" else echo shar: Extracting \"dump/dumprmt.c.diff\" \(1034 characters\) sed "s/^X//" >dump/dumprmt.c.diff <<'END_OF_dump/dumprmt.c.diff' X*** dumprmt.c.ORIG Sat Jan 9 16:27:01 1988 X--- dumprmt.c Sun Jan 10 21:22:29 1988 X*************** X*** 12,18 **** X #include <sys/mtio.h> X #include <sys/ioctl.h> X #include <sys/socket.h> X! #include <sys/inode.h> X X #include <netinet/in.h> X X--- 12,20 ---- X #include <sys/mtio.h> X #include <sys/ioctl.h> X #include <sys/socket.h> X! #include <sys/time.h> X! #include <sys/vnode.h> X! #include <ufs/inode.h> X X #include <netinet/in.h> X X*************** X*** 69,76 **** X name = pw->pw_name; X rmtape = rcmd(&rmtpeer, sp->s_port, name, name, "/etc/rmt", 0); X size = ntrec * TP_BSIZE; X! while (size > TP_BSIZE && X! setsockopt(rmtape, SOL_SOCKET, SO_SNDBUF, &size, sizeof (size)) < 0) X size -= TP_BSIZE; X } X X--- 71,81 ---- X name = pw->pw_name; X rmtape = rcmd(&rmtpeer, sp->s_port, name, name, "/etc/rmt", 0); X size = ntrec * TP_BSIZE; X! /* X! ** while (size > TP_BSIZE && X! ** setsockopt(rmtape, SOL_SOCKET, SO_SNDBUF, &size, sizeof (size)) < 0) X! */ X! while (size > TP_BSIZE) X size -= TP_BSIZE; X } X END_OF_dump/dumprmt.c.diff if test 1034 -ne `wc -c <dump/dumprmt.c.diff`; then echo shar: \"dump/dumprmt.c.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f dump/dumptraverse.c.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump/dumptraverse.c.diff\" else echo shar: Extracting \"dump/dumptraverse.c.diff\" \(2227 characters\) sed "s/^X//" >dump/dumptraverse.c.diff <<'END_OF_dump/dumptraverse.c.diff' X*** dumptraverse.c.ORIG Sat Jan 9 16:27:01 1988 X--- dumptraverse.c Tue Jul 12 16:46:07 1988 X*************** X*** 65,71 **** X return; X nsubdir = 0; X dadded = 0; X! filesize = ip->di_size; X for (i = 0; i < NDADDR; i++) { X if (ip->di_db[i] != 0) X dsrch(ip->di_db[i], dblksize(sblock, ip, i), filesize); X--- 65,71 ---- X return; X nsubdir = 0; X dadded = 0; X! filesize = roundup(ip->di_size, DEV_BSIZE); X for (i = 0; i < NDADDR; i++) { X if (ip->di_db[i] != 0) X dsrch(ip->di_db[i], dblksize(sblock, ip, i), filesize); X*************** X*** 138,143 **** X--- 138,158 ---- X i = ip->di_mode & IFMT; X if (i == 0) /* free inode */ X return; X+ #ifdef PYRAMID X+ if (i == IFLNK && ip->di_size == 0) { X+ for (i = NCLNK - 1; i >= 0; i--) X+ if (size = ip->di_ic.ic_sylinks[i].sy_len) { X+ spcl.c_dinode.di_size = ip->di_ic.ic_sylinks[i].sy_offset + size; X+ break; X+ } X+ spcl.c_addr[0] = spcl.c_count = 1; X+ spclrec(); X+ spcl.c_dinode.di_size = -1; X+ spclrec(); X+ return; X+ } X+ #endif PYRAMID X+ X if ((i != IFDIR && i != IFREG && i != IFLNK) || ip->di_size == 0) { X spclrec(); X return; X*************** X*** 246,251 **** X--- 261,273 ---- X s += *ip++; s += *ip++; X } X spcl.c_checksum = CHECKSUM - s; X+ X+ #ifdef PYRAMID X+ if (spcl.c_dinode.di_size == -1) X+ taprec((char *)&spcl.c_dinode.di_db[0]); X+ else X+ #endif PYRAMID X+ X taprec((char *)&spcl); X } X X*************** X*** 253,259 **** X daddr_t d; X int size, filesize; X { X! register struct direct *dp; X long loc; X char dblk[MAXBSIZE]; X X--- 275,281 ---- X daddr_t d; X int size, filesize; X { X! register UNIXDIRECT *dp; X long loc; X char dblk[MAXBSIZE]; X X*************** X*** 263,269 **** X filesize = size; X bread(fsbtodb(sblock, d), dblk, filesize); X for (loc = 0; loc < filesize; ) { X! dp = (struct direct *)(dblk + loc); X if (dp->d_reclen == 0) { X msg("corrupted directory, inumber %d\n", ino); X break; X--- 285,291 ---- X filesize = size; X bread(fsbtodb(sblock, d), dblk, filesize); X for (loc = 0; loc < filesize; ) { X! dp = (UNIXDIRECT *)(dblk + loc); X if (dp->d_reclen == 0) { X msg("corrupted directory, inumber %d\n", ino); X break; END_OF_dump/dumptraverse.c.diff if test 2227 -ne `wc -c <dump/dumptraverse.c.diff`; then echo shar: \"dump/dumptraverse.c.diff\" unpacked with wrong size! fi # end of overwriting check fi if test ! -d restore ; then echo shar: Creating directory \"restore\" mkdir restore fi if test -f restore/Makefile.SUNOS4.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/Makefile.SUNOS4.diff\" else echo shar: Extracting \"restore/Makefile.SUNOS4.diff\" \(198 characters\) sed "s/^X//" >restore/Makefile.SUNOS4.diff <<'END_OF_restore/Makefile.SUNOS4.diff' X9c9 X< CFLAGS= -O X--- X> CFLAGS= -O -DSUNOS4 X11a12 X> LDFLAGS=-Bstatic X19c20 X< cc ${LDFLAGS} -o rrestore ${OBJS} rtape.o dumprmt.o X--- X> cc ${LDFLAGS} ${CFLAGS} -o rrestore ${OBJS} rtape.o dumprmt.o END_OF_restore/Makefile.SUNOS4.diff if test 198 -ne `wc -c <restore/Makefile.SUNOS4.diff`; then echo shar: \"restore/Makefile.SUNOS4.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f restore/Makefile.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/Makefile.diff\" else echo shar: Extracting \"restore/Makefile.diff\" \(130 characters\) sed "s/^X//" >restore/Makefile.diff <<'END_OF_restore/Makefile.diff' X19c19 X< cc ${LDFLAGS} -o rrestore ${OBJS} rtape.o dumprmt.o X--- X> cc ${LDFLAGS} ${CFLAGS} -o rrestore ${OBJS} rtape.o dumprmt.o END_OF_restore/Makefile.diff if test 130 -ne `wc -c <restore/Makefile.diff`; then echo shar: \"restore/Makefile.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f restore/README -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/README\" else echo shar: Extracting \"restore/README\" \(1860 characters\) sed "s/^X//" >restore/README <<'END_OF_restore/README' Xdpz's changes to the standard 4.3BSD restore for compatible Sun SunOS X3.x, Sun SunOS 4.0, Pyramid OSx4.1, and Celerity 3.4 restores: X X - replacing various #include files with equivalents X - adding DIRBLKSIZ #define, making it largest DEV_BSIZE of all X architectures X - copying DIR struct definition to RST_DIR, changing char X *dd_buf in it to char dd_buf[DIRBLKSIZ], changing all X routines that use DIR to use RST_DIR X - copying 4.3 opendir() to rst_4_3_opendir() and changing X appropriate routines to call that instead of opendir() X - copying 4.3 telldir() to rst_4_3_telldir(), changing X appropriate routines to call that instead of telldir() X X - compile on Sun SunOS 4.0 with -DSUNOS4 in Makefile and link X statically X - generalizing "struct direct" to a typedef, since SunOS 4.0 X has a field in it that doesn't exist on disk X X - adding/modifying /usr/include/protocols/dumprestore.h: X - have TP_BSIZE equal the largest disk block size X across all three architectures (2048 in this case) X - adjusting NTREC and HIGHDENSITYTREC down to balance X my higher TP_BSIZE X - adjusting DUMPOUTFMT and DUMPINFMT to have the X highest number across all three architectures for %XXs X - adding CARTRIDGETREC for some reason X XFrills: X - modifying Makefile so ${CFLAGS} is included in final .o combining X - adding Gary Winiger's epoch dump date mod (his comments below) X - adding Gary Winiger's interactive.c seg violation mods (cmts below) X XFrom: gww@elxsi.UUCP (Gary Winiger) X XWhen restore lists the dates the the dump encompases such as with the X-t option, it will list the epoch date for the from date of a level 0 Xdump. X XFrom: gww@elxsi.UUCP (Gary Winiger) X XWhen running /etc/restore in interactive mode, any attempt to Xreference a subdirectory will cause a segmentation violation on Xsystems that do not permit dereferencing a NULL pointer. END_OF_restore/README if test 1860 -ne `wc -c <restore/README`; then echo shar: \"restore/README\" unpacked with wrong size! fi # end of overwriting check fi if test -f restore/dirs.c.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/dirs.c.diff\" else echo shar: Extracting \"restore/dirs.c.diff\" \(7404 characters\) sed "s/^X//" >restore/dirs.c.diff <<'END_OF_restore/dirs.c.diff' X*** dirs.c.ORIG Sat Jan 9 16:27:02 1988 X--- dirs.c Wed Aug 17 17:39:13 1988 X*************** X*** 43,53 **** X */ X static daddr_t seekpt; X static FILE *df, *mf; X! static DIR *dirp; X static char dirfile[32] = "#"; /* No file */ X static char modefile[32] = "#"; /* No file */ X extern ino_t search(); X! struct direct *rst_readdir(); X extern void rst_seekdir(); X X /* X--- 43,54 ---- X */ X static daddr_t seekpt; X static FILE *df, *mf; X! static RST_DIR *dirp; X static char dirfile[32] = "#"; /* No file */ X static char modefile[32] = "#"; /* No file */ X extern ino_t search(); X! RST_DIR *rst_4_3_opendir(); X! UNIXDIRECT *rst_readdir(); X extern void rst_seekdir(); X X /* X*************** X*** 71,77 **** X register int i; X register struct dinode *ip; X struct inotab *itp; X! struct direct nulldir; X int putdir(), null(); X X vprintf(stdout, "Extract directories from tape\n"); X--- 72,78 ---- X register int i; X register struct dinode *ip; X struct inotab *itp; X! UNIXDIRECT nulldir; X int putdir(), null(); X X vprintf(stdout, "Extract directories from tape\n"); X*************** X*** 105,111 **** X ip = curfile.dip; X if (ip == NULL || (ip->di_mode & IFMT) != IFDIR) { X (void) fclose(df); X! dirp = opendir(dirfile); X if (dirp == NULL) X perror("opendir"); X if (mf != NULL) X--- 106,112 ---- X ip = curfile.dip; X if (ip == NULL || (ip->di_mode & IFMT) != IFDIR) { X (void) fclose(df); X! dirp = rst_4_3_opendir(dirfile); X if (dirp == NULL) X perror("opendir"); X if (mf != NULL) X*************** X*** 144,150 **** X long (*todo)(); X { X register struct inotab *itp; X! register struct direct *dp; X register struct entry *np; X int namelen; X daddr_t bpt; X--- 145,151 ---- X long (*todo)(); X { X register struct inotab *itp; X! register UNIXDIRECT *dp; X register struct entry *np; X int namelen; X daddr_t bpt; X*************** X*** 182,188 **** X else X fprintf(stderr, "Warning: `..' missing from directory %s\n", X pname); X! bpt = telldir(dirp); X /* X * a zero inode signals end of directory X */ X--- 183,189 ---- X else X fprintf(stderr, "Warning: `..' missing from directory %s\n", X pname); X! bpt = rst_4_3_telldir(dirp); X /* X * a zero inode signals end of directory X */ X*************** X*** 197,203 **** X rst_seekdir(dirp, bpt, itp->t_seekpt); X } X dp = rst_readdir(dirp); X! bpt = telldir(dirp); X } X if (dp == NULL) X fprintf(stderr, "corrupted directory: %s.\n", locname); X--- 198,204 ---- X rst_seekdir(dirp, bpt, itp->t_seekpt); X } X dp = rst_readdir(dirp); X! bpt = rst_4_3_telldir(dirp); X } X if (dp == NULL) X fprintf(stderr, "corrupted directory: %s.\n", locname); X*************** X*** 246,252 **** X ino_t inum; X char *cp; X { X! register struct direct *dp; X register struct inotab *itp; X int len; X X--- 247,253 ---- X ino_t inum; X char *cp; X { X! register UNIXDIRECT *dp; X register struct inotab *itp; X int len; X X*************** X*** 270,279 **** X char *buf; X int size; X { X! struct direct cvtbuf; X register struct odirect *odp; X struct odirect *eodp; X! register struct direct *dp; X long loc, i; X extern int Bcvt; X X--- 271,280 ---- X char *buf; X int size; X { X! UNIXDIRECT cvtbuf; X register struct odirect *odp; X struct odirect *eodp; X! register UNIXDIRECT *dp; X long loc, i; X extern int Bcvt; X X*************** X*** 286,292 **** X } X } else { X for (loc = 0; loc < size; ) { X! dp = (struct direct *)(buf + loc); X if (Bcvt) { X swabst("l2s", (char *) dp); X } X--- 287,293 ---- X } X } else { X for (loc = 0; loc < size; ) { X! dp = (UNIXDIRECT *)(buf + loc); X if (Bcvt) { X swabst("l2s", (char *) dp); X } X*************** X*** 314,324 **** X * add a new directory entry to a file. X */ X putent(dp) X! struct direct *dp; X { X dp->d_reclen = DIRSIZ(dp); X if (dirloc + dp->d_reclen > DIRBLKSIZ) { X! ((struct direct *)(dirbuf + prev))->d_reclen = X DIRBLKSIZ - prev; X (void) fwrite(dirbuf, 1, DIRBLKSIZ, df); X dirloc = 0; X--- 315,325 ---- X * add a new directory entry to a file. X */ X putent(dp) X! UNIXDIRECT *dp; X { X dp->d_reclen = DIRSIZ(dp); X if (dirloc + dp->d_reclen > DIRBLKSIZ) { X! ((UNIXDIRECT *)(dirbuf + prev))->d_reclen = X DIRBLKSIZ - prev; X (void) fwrite(dirbuf, 1, DIRBLKSIZ, df); X dirloc = 0; X*************** X*** 334,340 **** X flushent() X { X X! ((struct direct *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev; X (void) fwrite(dirbuf, (int)dirloc, 1, df); X seekpt = ftell(df); X dirloc = 0; X--- 335,341 ---- X flushent() X { X X! ((UNIXDIRECT *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev; X (void) fwrite(dirbuf, (int)dirloc, 1, df); X seekpt = ftell(df); X dirloc = 0; X*************** X*** 342,348 **** X X dcvt(odp, ndp) X register struct odirect *odp; X! register struct direct *ndp; X { X X bzero((char *)ndp, (long)(sizeof *ndp)); X--- 343,349 ---- X X dcvt(odp, ndp) X register struct odirect *odp; X! register UNIXDIRECT *ndp; X { X X bzero((char *)ndp, (long)(sizeof *ndp)); X*************** X*** 354,360 **** X X /* X * Seek to an entry in a directory. X! * Only values returned by ``telldir'' should be passed to rst_seekdir. X * This routine handles many directories in a single file. X * It takes the base of the directory in the file, plus X * the desired seek offset into it. X--- 355,361 ---- X X /* X * Seek to an entry in a directory. X! * Only values returned by ``rst_4_3_telldir'' should be passed to rst_seekdir. X * This routine handles many directories in a single file. X * It takes the base of the directory in the file, plus X * the desired seek offset into it. X*************** X*** 361,371 **** X */ X void X rst_seekdir(dirp, loc, base) X! register DIR *dirp; X daddr_t loc, base; X { X X! if (loc == telldir(dirp)) X return; X loc -= base; X if (loc < 0) X--- 362,372 ---- X */ X void X rst_seekdir(dirp, loc, base) X! register RST_DIR *dirp; X daddr_t loc, base; X { X X! if (loc == rst_4_3_telldir(dirp)) X return; X loc -= base; X if (loc < 0) X*************** X*** 379,389 **** X /* X * get next entry in a directory. X */ X! struct direct * X rst_readdir(dirp) X! register DIR *dirp; X { X! register struct direct *dp; X X for (;;) { X if (dirp->dd_loc == 0) { X--- 380,390 ---- X /* X * get next entry in a directory. X */ X! UNIXDIRECT * X rst_readdir(dirp) X! register RST_DIR *dirp; X { X! register UNIXDIRECT *dp; X X for (;;) { X if (dirp->dd_loc == 0) { X*************** X*** 398,404 **** X dirp->dd_loc = 0; X continue; X } X! dp = (struct direct *)(dirp->dd_buf + dirp->dd_loc); X if (dp->d_reclen == 0 || X dp->d_reclen > DIRBLKSIZ + 1 - dirp->dd_loc) { X dprintf(stderr, "corrupted directory: bad reclen %d\n", X--- 399,405 ---- X dirp->dd_loc = 0; X continue; X } X! dp = (UNIXDIRECT *)(dirp->dd_buf + dirp->dd_loc); X if (dp->d_reclen == 0 || X dp->d_reclen > DIRBLKSIZ + 1 - dirp->dd_loc) { X dprintf(stderr, "corrupted directory: bad reclen %d\n", X*************** X*** 417,426 **** X } X } X X /* X * Simulate the opening of a directory X */ X! DIR * X rst_opendir(name) X char *name; X { X--- 418,431 ---- X } X } X X+ #include "opendir.c" X+ X+ #include "telldir.c" X+ X /* X * Simulate the opening of a directory X */ X! RST_DIR * X rst_opendir(name) X char *name; X { END_OF_restore/dirs.c.diff if test 7404 -ne `wc -c <restore/dirs.c.diff`; then echo shar: \"restore/dirs.c.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f restore/dumprestore.h.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/dumprestore.h.diff\" else echo shar: Extracting \"restore/dumprestore.h.diff\" \(1680 characters\) sed "s/^X//" >restore/dumprestore.h.diff <<'END_OF_restore/dumprestore.h.diff' X*** dumprestore.h.ORIG Mon Apr 18 21:33:00 1988 X--- dumprestore.h Tue Aug 16 17:08:45 1988 X*************** X*** 13,26 **** X * NTREC is the number of TP_BSIZE blocks that are written X * in each tape record. HIGHDENSITYTREC is the number of X * TP_BSIZE blocks that are written in each tape record on X! * 6250 BPI or higher density tapes. X * X * TP_NINDIR is the number of indirect pointers in a TS_INODE X * or TS_ADDR record. Note that it must be a power of two. X */ X! #define TP_BSIZE 1024 X! #define NTREC 10 X! #define HIGHDENSITYTREC 32 X #define TP_NINDIR (TP_BSIZE/2) X X #define TS_TAPE 1 X--- 13,29 ---- X * NTREC is the number of TP_BSIZE blocks that are written X * in each tape record. HIGHDENSITYTREC is the number of X * TP_BSIZE blocks that are written in each tape record on X! * 6250 BPI or higher density tapes. CARTRIDGETREC is the X! * number of TP_BSIZE blocks that are written in each tape X! * record on cartridge tapes. X * X * TP_NINDIR is the number of indirect pointers in a TS_INODE X * or TS_ADDR record. Note that it must be a power of two. X */ X! #define TP_BSIZE 2048 X! #define NTREC 5 X! #define HIGHDENSITYTREC 16 X! #define CARTRIDGETREC 31 X #define TP_NINDIR (TP_BSIZE/2) X X #define TS_TAPE 1 X*************** X*** 52,57 **** X X #define spcl u_spcl.s_spcl X X! #define DUMPOUTFMT "%-16s %c %s" /* for printf */ X /* name, incno, ctime(date) */ X! #define DUMPINFMT "%16s %c %[^\n]\n" /* inverse for scanf */ X--- 55,60 ---- X X #define spcl u_spcl.s_spcl X X! #define DUMPOUTFMT "%-22s %c %s" /* for printf */ X /* name, incno, ctime(date) */ X! #define DUMPINFMT "%22s %c %[^\n]\n" /* inverse for scanf */ END_OF_restore/dumprestore.h.diff if test 1680 -ne `wc -c <restore/dumprestore.h.diff`; then echo shar: \"restore/dumprestore.h.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f restore/interactive.c.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/interactive.c.diff\" else echo shar: Extracting \"restore/interactive.c.diff\" \(2167 characters\) sed "s/^X//" >restore/interactive.c.diff <<'END_OF_restore/interactive.c.diff' X*** interactive.c.ORIG Sat Jan 9 16:27:01 1988 X--- interactive.c Tue Jul 12 17:00:11 1988 X*************** X*** 398,409 **** X register struct arglist *ap; X { X static struct afile single; X int size; X X ap->head = ap->last = (struct afile *)0; X size = expand(arg, 0, ap); X if (size == 0) { X! single.fnum = lookupname(arg)->e_ino; X single.fname = savename(arg); X ap->head = &single; X ap->last = ap->head + 1; X--- 398,411 ---- X register struct arglist *ap; X { X static struct afile single; X+ struct entry *ep; X int size; X X ap->head = ap->last = (struct afile *)0; X size = expand(arg, 0, ap); X if (size == 0) { X! ep = lookupname(arg); X! single.fnum = ep != NIL ? ep->e_ino : 0; X single.fname = savename(arg); X ap->head = &single; X ap->last = ap->head + 1; X*************** X*** 423,432 **** X int count, size; X char dir = 0; X char *rescan = 0; X! DIR *dirp; X register char *s, *cs; X int sindex, rindex, lindex; X! struct direct *dp; X register char slash; X register char *rs; X register char c; X--- 425,434 ---- X int count, size; X char dir = 0; X char *rescan = 0; X! RST_DIR *dirp; X register char *s, *cs; X int sindex, rindex, lindex; X! UNIXDIRECT *dp; X register char slash; X register char *rs; X register char c; X*************** X*** 571,577 **** X * Construct a matched name. X */ X addg(dp, as1, as3, ap) X! struct direct *dp; X char *as1, *as3; X struct arglist *ap; X { X--- 573,579 ---- X * Construct a matched name. X */ X addg(dp, as1, as3, ap) X! UNIXDIRECT *dp; X char *as1, *as3; X struct arglist *ap; X { X*************** X*** 609,618 **** X char *basename; X { X register struct afile *fp; X! register struct direct *dp; X static struct arglist alist = { 0, 0, 0, 0, "ls" }; X struct afile single; X! DIR *dirp; X X if ((dirp = rst_opendir(name)) == NULL) { X single.fnum = ino; X--- 611,620 ---- X char *basename; X { X register struct afile *fp; X! register UNIXDIRECT *dp; X static struct arglist alist = { 0, 0, 0, 0, "ls" }; X struct afile single; X! RST_DIR *dirp; X X if ((dirp = rst_opendir(name)) == NULL) { X single.fnum = ino; END_OF_restore/interactive.c.diff if test 2167 -ne `wc -c <restore/interactive.c.diff`; then echo shar: \"restore/interactive.c.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f restore/main.c.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/main.c.diff\" else echo shar: Extracting \"restore/main.c.diff\" \(338 characters\) sed "s/^X//" >restore/main.c.diff <<'END_OF_restore/main.c.diff' X*** main.c.ORIG Sat Jan 9 16:27:00 1988 X--- main.c Tue Jul 12 16:39:19 1988 X*************** X*** 58,64 **** X--- 58,66 ---- X char *inputdev = "/dev/rmt8"; X char *symtbl = "./restoresymtable"; X char name[MAXPATHLEN]; X+ #ifndef SUNOS4 X int (*signal())(); X+ #endif X extern int onintr(); X X if (signal(SIGINT, onintr) == SIG_IGN) END_OF_restore/main.c.diff if test 338 -ne `wc -c <restore/main.c.diff`; then echo shar: \"restore/main.c.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f restore/opendir.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/opendir.c\" else echo shar: Extracting \"restore/opendir.c\" \(1135 characters\) sed "s/^X//" >restore/opendir.c <<'END_OF_restore/opendir.c' X/* X * Copyright (c) 1983 Regents of the University of California. X * All rights reserved. X * X * Redistribution and use in source and binary forms are permitted X * provided that the above copyright notice and this paragraph are X * duplicated in all such forms and that any documentation, X * advertising materials, and other materials related to such X * distribution and use acknowledge that the software was developed X * by the University of California, Berkeley. The name of the X * University may not be used to endorse or promote products derived X * from this software without specific prior written permission. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. X */ X X/* X * open a directory. X */ XRST_DIR * Xrst_4_3_opendir(name) X char *name; X{ X register RST_DIR *dirp; X register int fd; X X if ((fd = open(name, 0)) == -1) X return NULL; X if ((dirp = (RST_DIR *)malloc(sizeof(RST_DIR))) == NULL) { X close (fd); X return NULL; X } X dirp->dd_fd = fd; X dirp->dd_loc = 0; X return dirp; X} END_OF_restore/opendir.c if test 1135 -ne `wc -c <restore/opendir.c`; then echo shar: \"restore/opendir.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f restore/restore.h.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/restore.h.diff\" else echo shar: Extracting \"restore/restore.h.diff\" \(1561 characters\) sed "s/^X//" >restore/restore.h.diff <<'END_OF_restore/restore.h.diff' X*** restore.h.ORIG Sat Jan 9 16:27:01 1988 X--- restore.h Tue Jul 12 17:02:25 1988 X*************** X*** 8,17 **** X X #include <stdio.h> X #include <sys/param.h> X! #include <sys/inode.h> X! #include <sys/fs.h> X #include <sys/dir.h> X X /* X * Flags X */ X--- 8,42 ---- X X #include <stdio.h> X #include <sys/param.h> X! #include <sys/time.h> X! #include <sys/vnode.h> X! #include <ufs/inode.h> X! #include <ufs/fs.h> X #include <sys/dir.h> X X+ #ifdef SUNOS4 X+ typedef struct { X+ u_long d_fileno; /* file number of entry */ X+ u_short d_reclen; /* length of this record */ X+ u_short d_namlen; /* length of string in d_name */ X+ char d_name[MAXNAMLEN + 1]; /* name (up to MAXNAMLEN + 1) */ X+ } UNIXDIRECT; X+ #else X+ typedef struct direct UNIXDIRECT; X+ #endif X+ X+ #define DIRBLKSIZ 2048 X+ X+ typedef struct _rstdirdesc { X+ int dd_fd; X+ long dd_loc; X+ long dd_size; X+ long dd_bbase; X+ long dd_entno; X+ long dd_bsize; X+ char dd_buf[DIRBLKSIZ]; X+ } RST_DIR; X+ X /* X * Flags X */ X*************** X*** 76,83 **** X extern char *flagvalues(); X extern ino_t lowerbnd(); X extern ino_t upperbnd(); X! extern DIR *rst_opendir(); X! extern struct direct *rst_readdir(); X #define NIL ((struct entry *)(0)) X /* X * Constants associated with entry structs X--- 101,108 ---- X extern char *flagvalues(); X extern ino_t lowerbnd(); X extern ino_t upperbnd(); X! extern RST_DIR *rst_opendir(); X! extern UNIXDIRECT *rst_readdir(); X #define NIL ((struct entry *)(0)) X /* X * Constants associated with entry structs END_OF_restore/restore.h.diff if test 1561 -ne `wc -c <restore/restore.h.diff`; then echo shar: \"restore/restore.h.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f restore/tape.c.diff -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/tape.c.diff\" else echo shar: Extracting \"restore/tape.c.diff\" \(627 characters\) sed "s/^X//" >restore/tape.c.diff <<'END_OF_restore/tape.c.diff' X*** tape.c.ORIG Sat Jan 9 16:27:03 1988 X--- tape.c Sun May 29 19:09:30 1988 X*************** X*** 153,159 **** X } X if (vflag || command == 't') { X fprintf(stdout, "Dump date: %s", ctime(&spcl.c_date)); X! fprintf(stdout, "Dumped from: %s", ctime(&spcl.c_ddate)); X } X dumptime = spcl.c_ddate; X dumpdate = spcl.c_date; X--- 153,161 ---- X } X if (vflag || command == 't') { X fprintf(stdout, "Dump date: %s", ctime(&spcl.c_date)); X! fprintf(stdout, "Dumped from: %s", X! (spcl.c_ddate == (time_t)0) X! ? "the epoch\n" : ctime(&spcl.c_ddate)); X } X dumptime = spcl.c_ddate; X dumpdate = spcl.c_date; END_OF_restore/tape.c.diff if test 627 -ne `wc -c <restore/tape.c.diff`; then echo shar: \"restore/tape.c.diff\" unpacked with wrong size! fi # end of overwriting check fi if test -f restore/telldir.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"restore/telldir.c\" else echo shar: Extracting \"restore/telldir.c\" \(1004 characters\) sed "s/^X//" >restore/telldir.c <<'END_OF_restore/telldir.c' X/* X * Copyright (c) 1983 Regents of the University of California. X * All rights reserved. X * X * Redistribution and use in source and binary forms are permitted X * provided that the above copyright notice and this paragraph are X * duplicated in all such forms and that any documentation, X * advertising materials, and other materials related to such X * distribution and use acknowledge that the software was developed X * by the University of California, Berkeley. The name of the X * University may not be used to endorse or promote products derived X * from this software without specific prior written permission. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. X */ X X/* X * return a pointer into a directory X */ Xlong Xrst_4_3_telldir(dirp) X RST_DIR *dirp; X{ X extern long lseek(); X X return (lseek(dirp->dd_fd, 0L, 1) - dirp->dd_size + dirp->dd_loc); X} END_OF_restore/telldir.c if test 1004 -ne `wc -c <restore/telldir.c`; then echo shar: \"restore/telldir.c\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of shell archive. exit 0 -- David P. Zimmerman, Rutgers, the NJIN Project, the UUCP Project, etc, etc dpz@pilot.njin.net {rutgers,njin}!dpz zimmerman@zodiac.bitnet