new fstab format
[unix-history] / usr / src / sbin / dump / dump.h
CommitLineData
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
27int msiz;
28char *clrmap;
29char *dirmap;
30char *nodmap;
10d665ef
BJ
31
32/*
33 * All calculations done in 0.1" units!
34 */
35
36char *disk; /* name of the disk file */
37char *tape; /* name of the tape file */
38char *increm; /* name of the file containing incremental information*/
39char incno; /* increment number */
40int uflag; /* update flag */
41int fi; /* disk file descriptor */
42int to; /* tape file descriptor */
a47b7e40 43int pipeout; /* true => output to standard output */
10d665ef
BJ
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
10d665ef 103struct 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
109struct idates {
110 char id_name[MAXNAMLEN+3];
111 char id_incno;
112 time_t id_ddate;
113};
10d665ef
BJ
114struct itime{
115 struct idates it_value;
116 struct itime *it_next;
117};
118struct itime *ithead; /* head of the list version */
119int nidates; /* number of records (might be zero) */
120int idates_in; /* we have read the increment file */
121struct 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 */
127int sighup();
128int sigquit();
129int sigill();
130int sigtrap();
131int sigfpe();
132int sigkill();
133int sigbus();
134int sigsegv();
135int sigsys();
136int sigalrm();
137int sigterm();