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