re-read /etc/dumpdates before updating it
[unix-history] / usr / src / sbin / dump / dump.h
CommitLineData
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 19int (*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
28int msiz;
29char *clrmap;
30char *dirmap;
31char *nodmap;
10d665ef
BJ
32
33/*
34 * All calculations done in 0.1" units!
35 */
36
37char *disk; /* name of the disk file */
38char *tape; /* name of the tape file */
39char *increm; /* name of the file containing incremental information*/
40char incno; /* increment number */
41int uflag; /* update flag */
42int fi; /* disk file descriptor */
43int to; /* tape file descriptor */
a47b7e40 44int pipeout; /* true => output to standard output */
10d665ef
BJ
45ino_t ino; /* current inumber; used globally */
46int nsubdir;
47int newtape; /* new tape flag */
48int nadded; /* number of added sub directories */
49int dadded; /* directory added flag */
50int density; /* density in 0.1" units */
51long tsize; /* tape size in 0.1" units */
52long esize; /* estimated tape size, blocks */
53long asize; /* number of 0.1" units written on current tape */
54int etapes; /* estimated number of tapes */
55
56int notify; /* notify operator flag */
57int blockswritten; /* number of blocks written on current tape */
58int tapeno; /* current tape number */
59time_t tstart_writing; /* when started writing the first tape block */
60char *processname;
b6407c9d
KM
61struct fs *sblock; /* the file system super block */
62char buf[MAXBSIZE];
10d665ef
BJ
63
64char *ctime();
65char *prdate();
66long atol();
67int mark();
68int add();
69int dump();
70int tapsrec();
71int dmpspc();
72int dsrch();
73int nullf();
74char *getsuffix();
75char *rawname();
003a2a9e 76struct dinode *getino();
10d665ef
BJ
77
78int 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
105struct fstab fstab[MAXFSTAB];
106struct fstab *fstabsearch(); /* search in fs_file and fs_spec */
107int 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
113struct idates {
114 char id_name[MAXNAMLEN+3];
115 char id_incno;
116 time_t id_ddate;
117};
10d665ef
BJ
118struct itime{
119 struct idates it_value;
120 struct itime *it_next;
121};
122struct itime *ithead; /* head of the list version */
123int nidates; /* number of records (might be zero) */
124int idates_in; /* we have read the increment file */
125struct 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 */
131int sighup();
132int sigquit();
133int sigill();
134int sigtrap();
135int sigfpe();
136int sigkill();
137int sigbus();
138int sigsegv();
139int sigsys();
140int sigalrm();
141int sigterm();