11421Sroot /* 2*13150Ssam * "@(#)dump.h 1.10 (Berkeley) 06/15/83" 31421Sroot */ 45328Smckusic #define NI 16 55328Smckusic #define MAXINOPB (MAXBSIZE / sizeof(struct dinode)) 65328Smckusic #define MAXNINDIR (MAXBSIZE / sizeof(daddr_t)) 71421Sroot 81421Sroot #include <stdio.h> 91421Sroot #include <ctype.h> 106642Ssam #include <sys/param.h> 116642Ssam #include <sys/stat.h> 126642Ssam #include <sys/fs.h> 136642Ssam #include <sys/inode.h> 146642Ssam #include <dumprestor.h> 158375Smckusick #include <dir.h> 161421Sroot #include <utmp.h> 171421Sroot #include <time.h> 181421Sroot #include <signal.h> 191421Sroot #include <fstab.h> 201421Sroot 215328Smckusic #define MWORD(m,i) (m[(unsigned)(i-1)/NBBY]) 225328Smckusic #define MBIT(i) (1<<((unsigned)(i-1)%NBBY)) 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 275328Smckusic int msiz; 285328Smckusic char *clrmap; 295328Smckusic char *dirmap; 305328Smckusic char *nodmap; 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 */ 381421Sroot char *increm; /* name of the file containing incremental information*/ 39*13150Ssam char *temp; /* name of the file for doing rewrite of increm */ 40*13150Ssam char lastincno; /* increment number of previous dump */ 411421Sroot char incno; /* increment number */ 421421Sroot int uflag; /* update flag */ 431421Sroot int fi; /* disk file descriptor */ 441421Sroot int to; /* tape file descriptor */ 4512331Smckusick int pipeout; /* true => output to standard output */ 461421Sroot ino_t ino; /* current inumber; used globally */ 471421Sroot int nsubdir; 481421Sroot int newtape; /* new tape flag */ 491421Sroot int nadded; /* number of added sub directories */ 501421Sroot int dadded; /* directory added flag */ 511421Sroot int density; /* density in 0.1" units */ 521421Sroot long tsize; /* tape size in 0.1" units */ 531421Sroot long esize; /* estimated tape size, blocks */ 541421Sroot long asize; /* number of 0.1" units written on current tape */ 551421Sroot int etapes; /* estimated number of tapes */ 561421Sroot 571421Sroot int notify; /* notify operator flag */ 581421Sroot int blockswritten; /* number of blocks written on current tape */ 591421Sroot int tapeno; /* current tape number */ 601421Sroot time_t tstart_writing; /* when started writing the first tape block */ 611421Sroot char *processname; 625328Smckusic struct fs *sblock; /* the file system super block */ 635328Smckusic char buf[MAXBSIZE]; 641421Sroot 651421Sroot char *ctime(); 661421Sroot char *prdate(); 671421Sroot long atol(); 681421Sroot int mark(); 691421Sroot int add(); 701421Sroot int dump(); 711421Sroot int tapsrec(); 721421Sroot int dmpspc(); 731421Sroot int dsrch(); 741421Sroot int nullf(); 751421Sroot char *getsuffix(); 761421Sroot char *rawname(); 774701Smckusic struct dinode *getino(); 781421Sroot 791421Sroot int interrupt(); /* in case operator bangs on console */ 801421Sroot 811421Sroot #define HOUR (60L*60L) 821421Sroot #define DAY (24L*HOUR) 831421Sroot #define YEAR (365L*DAY) 841421Sroot 851421Sroot /* 861421Sroot * Exit status codes 871421Sroot */ 881421Sroot #define X_FINOK 1 /* normal exit */ 891421Sroot #define X_REWRITE 2 /* restart writing from the check point */ 901421Sroot #define X_ABORT 3 /* abort all of dump; don't attempt checkpointing*/ 911421Sroot 921421Sroot #define NINCREM "/etc/dumpdates" /*new format incremental info*/ 93*13150Ssam #define TEMP "/etc/dtmp" /*output temp file*/ 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 struct fstab *fstabsearch(); /* search in fs_file and fs_spec */ 1011421Sroot 1021421Sroot /* 1031421Sroot * The contents of the file NINCREM is maintained both on 1041421Sroot * a linked list, and then (eventually) arrayified. 1051421Sroot */ 1068375Smckusick struct idates { 1078375Smckusick char id_name[MAXNAMLEN+3]; 1088375Smckusick char id_incno; 1098375Smckusick time_t id_ddate; 1108375Smckusick }; 1111421Sroot struct itime{ 1121421Sroot struct idates it_value; 1131421Sroot struct itime *it_next; 1141421Sroot }; 1151421Sroot struct itime *ithead; /* head of the list version */ 1161421Sroot int nidates; /* number of records (might be zero) */ 1171421Sroot int idates_in; /* we have read the increment file */ 1181421Sroot struct idates **idatev; /* the arrayfied version */ 1191421Sroot #define ITITERATE(i, ip) for (i = 0,ip = idatev[0]; i < nidates; i++, ip = idatev[i]) 1201421Sroot 1211421Sroot /* 1221421Sroot * We catch these interrupts 1231421Sroot */ 1241421Sroot int sighup(); 1251421Sroot int sigquit(); 1261421Sroot int sigill(); 1271421Sroot int sigtrap(); 1281421Sroot int sigfpe(); 1291421Sroot int sigkill(); 1301421Sroot int sigbus(); 1311421Sroot int sigsegv(); 1321421Sroot int sigsys(); 1331421Sroot int sigalrm(); 1341421Sroot int sigterm(); 135