1*14562Ssam /* dump.h 1.4 83/08/11 */ 2*14562Ssam 31421Sroot #define NI 16 41421Sroot #define DIRPB (BSIZE/sizeof(struct direct)) 51421Sroot 61421Sroot #include <stdio.h> 71421Sroot #include <ctype.h> 813048Ssam #include <fstab.h> 913048Ssam #include <signal.h> 1013048Ssam #include <utmp.h> 1112081Smckusick #include "include.4.1/sys/param.h" 1212081Smckusick #include "include.4.1/sys/stat.h" 1312081Smckusick #include "include.4.1/sys/filsys.h" 1412081Smckusick #include "include.4.1/sys/ino.h" 1512081Smckusick #include "include.4.1/sys/inode.h" 1612081Smckusick #include "include.4.1/sys/fblk.h" 1712081Smckusick #include "include.4.1/sys/dir.h" 1812081Smckusick #include "include.4.1/time.h" 1912081Smckusick #include "include.4.1/dumprestor.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 */ 3712081Smckusick char pipeout; /* true => output to standard output */ 381421Sroot char *increm; /* name of the file containing incremental information*/ 391421Sroot char incno; /* increment number */ 401421Sroot int uflag; /* update flag */ 411421Sroot int fi; /* disk file descriptor */ 421421Sroot int to; /* tape file descriptor */ 431421Sroot ino_t ino; /* current inumber; used globally */ 441421Sroot int nsubdir; 451421Sroot int newtape; /* new tape flag */ 461421Sroot int nadded; /* number of added sub directories */ 471421Sroot int dadded; /* directory added flag */ 481421Sroot int density; /* density in 0.1" units */ 491421Sroot long tsize; /* tape size in 0.1" units */ 501421Sroot long esize; /* estimated tape size, blocks */ 511421Sroot long asize; /* number of 0.1" units written on current tape */ 521421Sroot int etapes; /* estimated number of tapes */ 531421Sroot 541421Sroot int notify; /* notify operator flag */ 551421Sroot int blockswritten; /* number of blocks written on current tape */ 561421Sroot int tapeno; /* current tape number */ 571421Sroot time_t tstart_writing; /* when started writing the first tape block */ 581421Sroot char *processname; 591421Sroot 601421Sroot char *ctime(); 611421Sroot char *prdate(); 621421Sroot long atol(); 631421Sroot int mark(); 641421Sroot int add(); 651421Sroot int dump(); 661421Sroot int tapsrec(); 671421Sroot int dmpspc(); 681421Sroot int dsrch(); 691421Sroot int nullf(); 701421Sroot char *getsuffix(); 711421Sroot char *rawname(); 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 struct fstab *fstabsearch(); /* search in fs_file and fs_spec */ 1001421Sroot 1011421Sroot /* 1021421Sroot * The contents of the file NINCREM is maintained both on 1031421Sroot * a linked list, and then (eventually) arrayified. 1041421Sroot */ 1051421Sroot struct itime{ 1061421Sroot struct idates it_value; 1071421Sroot struct itime *it_next; 1081421Sroot }; 1091421Sroot struct itime *ithead; /* head of the list version */ 1101421Sroot int nidates; /* number of records (might be zero) */ 1111421Sroot int idates_in; /* we have read the increment file */ 1121421Sroot struct idates **idatev; /* the arrayfied version */ 1131421Sroot #define ITITERATE(i, ip) for (i = 0,ip = idatev[0]; i < nidates; i++, ip = idatev[i]) 1141421Sroot 1151421Sroot /* 1161421Sroot * We catch these interrupts 1171421Sroot */ 1181421Sroot int sighup(); 1191421Sroot int sigquit(); 1201421Sroot int sigill(); 1211421Sroot int sigtrap(); 1221421Sroot int sigfpe(); 1231421Sroot int sigkill(); 1241421Sroot int sigbus(); 1251421Sroot int sigsegv(); 1261421Sroot int sigsys(); 1271421Sroot int sigalrm(); 1281421Sroot int sigterm(); 129