1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)dump.h 5.15 (Berkeley) 03/07/91 8 */ 9 10 #define MAXINOPB (MAXBSIZE / sizeof(struct dinode)) 11 #define MAXNINDIR (MAXBSIZE / sizeof(daddr_t)) 12 13 /* 14 * Dump maps used to describe what is to be dumped. 15 */ 16 int mapsize; /* size of the state maps */ 17 char *usedinomap; /* map of allocated inodes */ 18 char *dumpdirmap; /* map of directories to be dumped */ 19 char *dumpinomap; /* map of files to be dumped */ 20 /* 21 * Map manipulation macros. 22 */ 23 #define SETINO(ino, map) \ 24 map[(u_int)((ino) - 1) / NBBY] |= 1 << ((u_int)((ino) - 1) % NBBY) 25 #define CLRINO(ino, map) \ 26 map[(u_int)((ino) - 1) / NBBY] &= ~(1 << ((u_int)((ino) - 1) % NBBY)) 27 #define TSTINO(ino, map) \ 28 (map[(u_int)((ino) - 1) / NBBY] & (1 << ((u_int)((ino) - 1) % NBBY))) 29 30 /* 31 * All calculations done in 0.1" units! 32 */ 33 char *disk; /* name of the disk file */ 34 char *tape; /* name of the tape file */ 35 char *dumpdates; /* name of the file containing dump date information*/ 36 char *temp; /* name of the file for doing rewrite of dumpdates */ 37 char lastlevel; /* dump level of previous dump */ 38 char level; /* dump level of this dump */ 39 int uflag; /* update flag */ 40 int diskfd; /* disk file descriptor */ 41 int tapefd; /* tape file descriptor */ 42 int pipeout; /* true => output to standard output */ 43 ino_t curino; /* current inumber; used globally */ 44 int newtape; /* new tape flag */ 45 int density; /* density in 0.1" units */ 46 long tapesize; /* estimated tape size, blocks */ 47 long tsize; /* tape size in 0.1" units */ 48 long asize; /* number of 0.1" units written on current tape */ 49 int etapes; /* estimated number of tapes */ 50 51 int notify; /* notify operator flag */ 52 int blockswritten; /* number of blocks written on current tape */ 53 int tapeno; /* current tape number */ 54 time_t tstart_writing; /* when started writing the first tape block */ 55 char *processname; 56 struct fs *sblock; /* the file system super block */ 57 char buf[MAXBSIZE]; 58 long dev_bsize; /* block size of underlying disk device */ 59 int dev_bshift; /* log2(dev_bsize) */ 60 int tp_bshift; /* log2(TP_BSIZE) */ 61 62 /* operator interface functions */ 63 void broadcast(); 64 void lastdump(); 65 void msg(); 66 void msgtail(); 67 int query(); 68 void set_operators(); 69 void timeest(); 70 71 /* mapping rouintes */ 72 long blockest(); 73 int mapfiles(); 74 int mapdirs(); 75 76 /* file dumping routines */ 77 void dirdump(); 78 void blksout(); 79 void dumpmap(); 80 void writeheader(); 81 void bread(); 82 83 /* tape writing routines */ 84 int alloctape(); 85 void writerec(); 86 void dumpblock(); 87 void flushtape(); 88 void trewind(); 89 void close_rewind(); 90 void startnewtape(); 91 92 void dumpabort(); 93 void Exit(); 94 void getfstab(); 95 void quit(); 96 97 char *rawname(); 98 struct dinode *getino(); 99 100 void interrupt(); /* in case operator bangs on console */ 101 102 /* 103 * Exit status codes 104 */ 105 #define X_FINOK 0 /* normal exit */ 106 #define X_REWRITE 2 /* restart writing from the check point */ 107 #define X_ABORT 3 /* abort all of dump; don't attempt checkpointing*/ 108 109 #define OPGRENT "operator" /* group entry to notify */ 110 #define DIALUP "ttyd" /* prefix for dialups */ 111 112 struct fstab *fstabsearch(); /* search in fs_file and fs_spec */ 113 114 /* 115 * The contents of the file _PATH_DUMPDATES is maintained both on 116 * a linked list, and then (eventually) arrayified. 117 */ 118 struct dumpdates { 119 char dd_name[MAXNAMLEN+3]; 120 char dd_level; 121 time_t dd_ddate; 122 }; 123 struct dumptime { 124 struct dumpdates dt_value; 125 struct dumptime *dt_next; 126 }; 127 struct dumptime *dthead; /* head of the list version */ 128 int nddates; /* number of records (might be zero) */ 129 int ddates_in; /* we have read the increment file */ 130 struct dumpdates **ddatev; /* the arrayfied version */ 131 void initdumptimes(); 132 void getdumptime(); 133 void putdumptime(); 134 #define ITITERATE(i, ddp) \ 135 for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i]) 136 137 /* 138 * We catch these interrupts 139 */ 140 void sighup(); 141 void sigquit(); 142 void sigill(); 143 void sigtrap(); 144 void sigfpe(); 145 void sigkill(); 146 void sigbus(); 147 void sigsegv(); 148 void sigsys(); 149 void sigalrm(); 150 void sigterm(); 151 152 /* 153 * Compatibility with old systems. 154 */ 155 #ifndef __STDC__ 156 #include <sys/file.h> 157 #define _PATH_FSTAB "/etc/fstab" 158 typedef int (*sig_t)(); 159 extern char *strdup(); 160 extern char *ctime(); 161 extern int errno; 162 #endif 163