11421Sroot /* 2*12081Smckusick * "@(#)dump.h 1.2 (Berkeley) 04/28/83" 31421Sroot */ 41421Sroot #define NI 16 51421Sroot #define DIRPB (BSIZE/sizeof(struct direct)) 61421Sroot 71421Sroot #include <stdio.h> 81421Sroot #include <ctype.h> 9*12081Smckusick #include "include.4.1/sys/param.h" 10*12081Smckusick #include "include.4.1/sys/stat.h" 11*12081Smckusick #include "include.4.1/sys/filsys.h" 12*12081Smckusick #include "include.4.1/sys/ino.h" 13*12081Smckusick #include "include.4.1/sys/inode.h" 14*12081Smckusick #include "include.4.1/sys/fblk.h" 15*12081Smckusick #include "include.4.1/sys/dir.h" 16*12081Smckusick #include "include.4.1/utmp.h" 17*12081Smckusick #include "include.4.1/time.h" 18*12081Smckusick #include "include.4.1/signal.h" 19*12081Smckusick #include "include.4.1/dumprestor.h" 20*12081Smckusick #include "include.4.1/fstab.h" 211421Sroot 221421Sroot #define MWORD(m,i) (m[(unsigned)(i-1)/MLEN]) 231421Sroot #define MBIT(i) (1<<((unsigned)(i-1)%MLEN)) 241421Sroot #define BIS(i,w) (MWORD(w,i) |= MBIT(i)) 251421Sroot #define BIC(i,w) (MWORD(w,i) &= ~MBIT(i)) 261421Sroot #define BIT(i,w) (MWORD(w,i) & MBIT(i)) 271421Sroot 281421Sroot short clrmap[MSIZ]; 291421Sroot short dirmap[MSIZ]; 301421Sroot short nodmap[MSIZ]; 311421Sroot 321421Sroot /* 331421Sroot * All calculations done in 0.1" units! 341421Sroot */ 351421Sroot 361421Sroot char *disk; /* name of the disk file */ 371421Sroot char *tape; /* name of the tape file */ 38*12081Smckusick char pipeout; /* true => output to standard output */ 391421Sroot char *increm; /* name of the file containing incremental information*/ 401421Sroot char incno; /* increment number */ 411421Sroot int uflag; /* update flag */ 421421Sroot int fi; /* disk file descriptor */ 431421Sroot int to; /* tape file descriptor */ 441421Sroot ino_t ino; /* current inumber; used globally */ 451421Sroot int nsubdir; 461421Sroot int newtape; /* new tape flag */ 471421Sroot int nadded; /* number of added sub directories */ 481421Sroot int dadded; /* directory added flag */ 491421Sroot int density; /* density in 0.1" units */ 501421Sroot long tsize; /* tape size in 0.1" units */ 511421Sroot long esize; /* estimated tape size, blocks */ 521421Sroot long asize; /* number of 0.1" units written on current tape */ 531421Sroot int etapes; /* estimated number of tapes */ 541421Sroot 551421Sroot int notify; /* notify operator flag */ 561421Sroot int blockswritten; /* number of blocks written on current tape */ 571421Sroot int tapeno; /* current tape number */ 581421Sroot time_t tstart_writing; /* when started writing the first tape block */ 591421Sroot char *processname; 601421Sroot 611421Sroot char *ctime(); 621421Sroot char *prdate(); 631421Sroot long atol(); 641421Sroot int mark(); 651421Sroot int add(); 661421Sroot int dump(); 671421Sroot int tapsrec(); 681421Sroot int dmpspc(); 691421Sroot int dsrch(); 701421Sroot int nullf(); 711421Sroot char *getsuffix(); 721421Sroot char *rawname(); 731421Sroot 741421Sroot int interrupt(); /* in case operator bangs on console */ 751421Sroot 761421Sroot #define HOUR (60L*60L) 771421Sroot #define DAY (24L*HOUR) 781421Sroot #define YEAR (365L*DAY) 791421Sroot 801421Sroot /* 811421Sroot * Exit status codes 821421Sroot */ 831421Sroot #define X_FINOK 1 /* normal exit */ 841421Sroot #define X_REWRITE 2 /* restart writing from the check point */ 851421Sroot #define X_ABORT 3 /* abort all of dump; don't attempt checkpointing*/ 861421Sroot 871421Sroot #ifdef DEBUG 881421Sroot #define OINCREM "./ddate" /*old format incremental info*/ 891421Sroot #define NINCREM "./dumpdates" /*new format incremental info*/ 901421Sroot #else not DEBUG 911421Sroot #define OINCREM "/etc/ddate" /*old format incremental info*/ 921421Sroot #define NINCREM "/etc/dumpdates" /*new format incremental info*/ 931421Sroot #endif 941421Sroot 951421Sroot #define TAPE "/dev/rmt8" /* default tape device */ 961421Sroot #define DISK "/dev/rrp1g" /* default disk */ 971421Sroot #define OPGRENT "operator" /* group entry to notify */ 981421Sroot #define DIALUP "ttyd" /* prefix for dialups */ 991421Sroot 1001421Sroot #define MAXFSTAB 32 1011421Sroot struct fstab fstab[MAXFSTAB]; 1021421Sroot struct fstab *fstabsearch(); /* search in fs_file and fs_spec */ 1031421Sroot int nfstab; 1041421Sroot 1051421Sroot /* 1061421Sroot * The contents of the file NINCREM is maintained both on 1071421Sroot * a linked list, and then (eventually) arrayified. 1081421Sroot */ 1091421Sroot struct itime{ 1101421Sroot struct idates it_value; 1111421Sroot struct itime *it_next; 1121421Sroot }; 1131421Sroot struct itime *ithead; /* head of the list version */ 1141421Sroot int nidates; /* number of records (might be zero) */ 1151421Sroot int idates_in; /* we have read the increment file */ 1161421Sroot struct idates **idatev; /* the arrayfied version */ 1171421Sroot #define ITITERATE(i, ip) for (i = 0,ip = idatev[0]; i < nidates; i++, ip = idatev[i]) 1181421Sroot 1191421Sroot /* 1201421Sroot * We catch these interrupts 1211421Sroot */ 1221421Sroot int sighup(); 1231421Sroot int sigquit(); 1241421Sroot int sigill(); 1251421Sroot int sigtrap(); 1261421Sroot int sigfpe(); 1271421Sroot int sigkill(); 1281421Sroot int sigbus(); 1291421Sroot int sigsegv(); 1301421Sroot int sigsys(); 1311421Sroot int sigalrm(); 1321421Sroot int sigterm(); 133