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