1*1421Sroot /* 2*1421Sroot * "@(#)dump.h 1.1 (Berkeley) 10/13/80" 3*1421Sroot */ 4*1421Sroot #define NI 16 5*1421Sroot #define DIRPB (BSIZE/sizeof(struct direct)) 6*1421Sroot 7*1421Sroot #include <stdio.h> 8*1421Sroot #include <ctype.h> 9*1421Sroot #include <sys/param.h> 10*1421Sroot #include <sys/stat.h> 11*1421Sroot #include <sys/filsys.h> 12*1421Sroot #include <sys/ino.h> 13*1421Sroot #include <sys/inode.h> 14*1421Sroot #include <sys/fblk.h> 15*1421Sroot #include <sys/dir.h> 16*1421Sroot #include <utmp.h> 17*1421Sroot #include <time.h> 18*1421Sroot #include <signal.h> 19*1421Sroot #include <dumprestor.h> 20*1421Sroot #include <fstab.h> 21*1421Sroot 22*1421Sroot #define MWORD(m,i) (m[(unsigned)(i-1)/MLEN]) 23*1421Sroot #define MBIT(i) (1<<((unsigned)(i-1)%MLEN)) 24*1421Sroot #define BIS(i,w) (MWORD(w,i) |= MBIT(i)) 25*1421Sroot #define BIC(i,w) (MWORD(w,i) &= ~MBIT(i)) 26*1421Sroot #define BIT(i,w) (MWORD(w,i) & MBIT(i)) 27*1421Sroot 28*1421Sroot short clrmap[MSIZ]; 29*1421Sroot short dirmap[MSIZ]; 30*1421Sroot short nodmap[MSIZ]; 31*1421Sroot 32*1421Sroot /* 33*1421Sroot * All calculations done in 0.1" units! 34*1421Sroot */ 35*1421Sroot 36*1421Sroot char *disk; /* name of the disk file */ 37*1421Sroot char *tape; /* name of the tape file */ 38*1421Sroot char *increm; /* name of the file containing incremental information*/ 39*1421Sroot char incno; /* increment number */ 40*1421Sroot int uflag; /* update flag */ 41*1421Sroot int fi; /* disk file descriptor */ 42*1421Sroot int to; /* tape file descriptor */ 43*1421Sroot ino_t ino; /* current inumber; used globally */ 44*1421Sroot int nsubdir; 45*1421Sroot int newtape; /* new tape flag */ 46*1421Sroot int nadded; /* number of added sub directories */ 47*1421Sroot int dadded; /* directory added flag */ 48*1421Sroot int density; /* density in 0.1" units */ 49*1421Sroot long tsize; /* tape size in 0.1" units */ 50*1421Sroot long esize; /* estimated tape size, blocks */ 51*1421Sroot long asize; /* number of 0.1" units written on current tape */ 52*1421Sroot int etapes; /* estimated number of tapes */ 53*1421Sroot 54*1421Sroot int notify; /* notify operator flag */ 55*1421Sroot int blockswritten; /* number of blocks written on current tape */ 56*1421Sroot int tapeno; /* current tape number */ 57*1421Sroot time_t tstart_writing; /* when started writing the first tape block */ 58*1421Sroot char *processname; 59*1421Sroot 60*1421Sroot char *ctime(); 61*1421Sroot char *prdate(); 62*1421Sroot long atol(); 63*1421Sroot int mark(); 64*1421Sroot int add(); 65*1421Sroot int dump(); 66*1421Sroot int tapsrec(); 67*1421Sroot int dmpspc(); 68*1421Sroot int dsrch(); 69*1421Sroot int nullf(); 70*1421Sroot char *getsuffix(); 71*1421Sroot char *rawname(); 72*1421Sroot 73*1421Sroot int interrupt(); /* in case operator bangs on console */ 74*1421Sroot 75*1421Sroot #define HOUR (60L*60L) 76*1421Sroot #define DAY (24L*HOUR) 77*1421Sroot #define YEAR (365L*DAY) 78*1421Sroot 79*1421Sroot /* 80*1421Sroot * Exit status codes 81*1421Sroot */ 82*1421Sroot #define X_FINOK 1 /* normal exit */ 83*1421Sroot #define X_REWRITE 2 /* restart writing from the check point */ 84*1421Sroot #define X_ABORT 3 /* abort all of dump; don't attempt checkpointing*/ 85*1421Sroot 86*1421Sroot #ifdef DEBUG 87*1421Sroot #define OINCREM "./ddate" /*old format incremental info*/ 88*1421Sroot #define NINCREM "./dumpdates" /*new format incremental info*/ 89*1421Sroot #else not DEBUG 90*1421Sroot #define OINCREM "/etc/ddate" /*old format incremental info*/ 91*1421Sroot #define NINCREM "/etc/dumpdates" /*new format incremental info*/ 92*1421Sroot #endif 93*1421Sroot 94*1421Sroot #define TAPE "/dev/rmt8" /* default tape device */ 95*1421Sroot #define DISK "/dev/rrp1g" /* default disk */ 96*1421Sroot #define OPGRENT "operator" /* group entry to notify */ 97*1421Sroot #define DIALUP "ttyd" /* prefix for dialups */ 98*1421Sroot 99*1421Sroot #define MAXFSTAB 32 100*1421Sroot struct fstab fstab[MAXFSTAB]; 101*1421Sroot struct fstab *fstabsearch(); /* search in fs_file and fs_spec */ 102*1421Sroot int nfstab; 103*1421Sroot 104*1421Sroot /* 105*1421Sroot * The contents of the file NINCREM is maintained both on 106*1421Sroot * a linked list, and then (eventually) arrayified. 107*1421Sroot */ 108*1421Sroot struct itime{ 109*1421Sroot struct idates it_value; 110*1421Sroot struct itime *it_next; 111*1421Sroot }; 112*1421Sroot struct itime *ithead; /* head of the list version */ 113*1421Sroot int nidates; /* number of records (might be zero) */ 114*1421Sroot int idates_in; /* we have read the increment file */ 115*1421Sroot struct idates **idatev; /* the arrayfied version */ 116*1421Sroot #define ITITERATE(i, ip) for (i = 0,ip = idatev[0]; i < nidates; i++, ip = idatev[i]) 117*1421Sroot 118*1421Sroot /* 119*1421Sroot * We catch these interrupts 120*1421Sroot */ 121*1421Sroot int sighup(); 122*1421Sroot int sigquit(); 123*1421Sroot int sigill(); 124*1421Sroot int sigtrap(); 125*1421Sroot int sigfpe(); 126*1421Sroot int sigkill(); 127*1421Sroot int sigbus(); 128*1421Sroot int sigsegv(); 129*1421Sroot int sigsys(); 130*1421Sroot int sigalrm(); 131*1421Sroot int sigterm(); 132