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