Commit | Line | Data |
---|---|---|
10d665ef BJ |
1 | /* |
2 | * "@(#)dump.h 1.1 (Berkeley) %G%" | |
3 | */ | |
4 | #define NI 16 | |
5 | #define DIRPB (BSIZE/sizeof(struct direct)) | |
6 | ||
7 | #include <stdio.h> | |
8 | #include <ctype.h> | |
9 | #include <sys/param.h> | |
10 | #include <sys/stat.h> | |
11 | #include <sys/filsys.h> | |
12 | #include <sys/ino.h> | |
13 | #include <sys/inode.h> | |
14 | #include <sys/fblk.h> | |
15 | #include <sys/dir.h> | |
16 | #include <utmp.h> | |
17 | #include <time.h> | |
18 | #include <signal.h> | |
19 | #include <dumprestor.h> | |
20 | #include <fstab.h> | |
21 | ||
22 | #define MWORD(m,i) (m[(unsigned)(i-1)/MLEN]) | |
23 | #define MBIT(i) (1<<((unsigned)(i-1)%MLEN)) | |
24 | #define BIS(i,w) (MWORD(w,i) |= MBIT(i)) | |
25 | #define BIC(i,w) (MWORD(w,i) &= ~MBIT(i)) | |
26 | #define BIT(i,w) (MWORD(w,i) & MBIT(i)) | |
27 | ||
28 | short clrmap[MSIZ]; | |
29 | short dirmap[MSIZ]; | |
30 | short nodmap[MSIZ]; | |
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 | ||
60 | char *ctime(); | |
61 | char *prdate(); | |
62 | long atol(); | |
63 | int mark(); | |
64 | int add(); | |
65 | int dump(); | |
66 | int tapsrec(); | |
67 | int dmpspc(); | |
68 | int dsrch(); | |
69 | int nullf(); | |
70 | char *getsuffix(); | |
71 | char *rawname(); | |
72 | ||
73 | int interrupt(); /* in case operator bangs on console */ | |
74 | ||
75 | #define HOUR (60L*60L) | |
76 | #define DAY (24L*HOUR) | |
77 | #define YEAR (365L*DAY) | |
78 | ||
79 | /* | |
80 | * Exit status codes | |
81 | */ | |
82 | #define X_FINOK 1 /* normal exit */ | |
83 | #define X_REWRITE 2 /* restart writing from the check point */ | |
84 | #define X_ABORT 3 /* abort all of dump; don't attempt checkpointing*/ | |
85 | ||
86 | #ifdef DEBUG | |
87 | #define OINCREM "./ddate" /*old format incremental info*/ | |
88 | #define NINCREM "./dumpdates" /*new format incremental info*/ | |
89 | #else not DEBUG | |
90 | #define OINCREM "/etc/ddate" /*old format incremental info*/ | |
91 | #define NINCREM "/etc/dumpdates" /*new format incremental info*/ | |
92 | #endif | |
93 | ||
94 | #define TAPE "/dev/rmt8" /* default tape device */ | |
95 | #define DISK "/dev/rrp1g" /* default disk */ | |
96 | #define OPGRENT "operator" /* group entry to notify */ | |
97 | #define DIALUP "ttyd" /* prefix for dialups */ | |
98 | ||
99 | #define MAXFSTAB 32 | |
100 | struct fstab fstab[MAXFSTAB]; | |
101 | struct fstab *fstabsearch(); /* search in fs_file and fs_spec */ | |
102 | int nfstab; | |
103 | ||
104 | /* | |
105 | * The contents of the file NINCREM is maintained both on | |
106 | * a linked list, and then (eventually) arrayified. | |
107 | */ | |
108 | struct itime{ | |
109 | struct idates it_value; | |
110 | struct itime *it_next; | |
111 | }; | |
112 | struct itime *ithead; /* head of the list version */ | |
113 | int nidates; /* number of records (might be zero) */ | |
114 | int idates_in; /* we have read the increment file */ | |
115 | struct idates **idatev; /* the arrayfied version */ | |
116 | #define ITITERATE(i, ip) for (i = 0,ip = idatev[0]; i < nidates; i++, ip = idatev[i]) | |
117 | ||
118 | /* | |
119 | * We catch these interrupts | |
120 | */ | |
121 | int sighup(); | |
122 | int sigquit(); | |
123 | int sigill(); | |
124 | int sigtrap(); | |
125 | int sigfpe(); | |
126 | int sigkill(); | |
127 | int sigbus(); | |
128 | int sigsegv(); | |
129 | int sigsys(); | |
130 | int sigalrm(); | |
131 | int sigterm(); |