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