zero link count table increased 50 => 500; corrupted directories now pfatal.
[unix-history] / usr / src / sbin / dump / dump.h
CommitLineData
10d665ef 1/*
38f6cf09 2 * "@(#)dump.h 1.7 (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 */
44ino_t ino; /* current inumber; used globally */
45int nsubdir;
46int newtape; /* new tape flag */
47int nadded; /* number of added sub directories */
48int dadded; /* directory added flag */
49int density; /* density in 0.1" units */
50long tsize; /* tape size in 0.1" units */
51long esize; /* estimated tape size, blocks */
52long asize; /* number of 0.1" units written on current tape */
53int etapes; /* estimated number of tapes */
54
55int notify; /* notify operator flag */
56int blockswritten; /* number of blocks written on current tape */
57int tapeno; /* current tape number */
58time_t tstart_writing; /* when started writing the first tape block */
59char *processname;
b6407c9d
KM
60struct fs *sblock; /* the file system super block */
61char buf[MAXBSIZE];
10d665ef
BJ
62
63char *ctime();
64char *prdate();
65long atol();
66int mark();
67int add();
68int dump();
69int tapsrec();
70int dmpspc();
71int dsrch();
72int nullf();
73char *getsuffix();
74char *rawname();
003a2a9e 75struct dinode *getino();
10d665ef
BJ
76
77int 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
103#define MAXFSTAB 32
104struct fstab fstab[MAXFSTAB];
105struct fstab *fstabsearch(); /* search in fs_file and fs_spec */
106int nfstab;
107
108/*
109 * The contents of the file NINCREM is maintained both on
110 * a linked list, and then (eventually) arrayified.
111 */
38f6cf09
KM
112struct idates {
113 char id_name[MAXNAMLEN+3];
114 char id_incno;
115 time_t id_ddate;
116};
10d665ef
BJ
117struct itime{
118 struct idates it_value;
119 struct itime *it_next;
120};
121struct itime *ithead; /* head of the list version */
122int nidates; /* number of records (might be zero) */
123int idates_in; /* we have read the increment file */
124struct idates **idatev; /* the arrayfied version */
125#define ITITERATE(i, ip) for (i = 0,ip = idatev[0]; i < nidates; i++, ip = idatev[i])
126
127/*
128 * We catch these interrupts
129 */
130int sighup();
131int sigquit();
132int sigill();
133int sigtrap();
134int sigfpe();
135int sigkill();
136int sigbus();
137int sigsegv();
138int sigsys();
139int sigalrm();
140int sigterm();