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