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