update, describe write-protected label and kernel consistency checks
[unix-history] / usr / src / sbin / dump / dump.h
CommitLineData
76797561
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 *
72e64d31 6 * @(#)dump.h 5.4 (Berkeley) %G%
76797561 7 */
080a6cff 8
b6407c9d 9#define NI 16
b6407c9d
KM
10#define MAXINOPB (MAXBSIZE / sizeof(struct dinode))
11#define MAXNINDIR (MAXBSIZE / sizeof(daddr_t))
10d665ef
BJ
12
13#include <stdio.h>
14#include <ctype.h>
1d9b1ad2
SL
15#include <sys/param.h>
16#include <sys/stat.h>
17#include <sys/fs.h>
18#include <sys/inode.h>
29df8dcd 19#include <protocols/dumprestore.h>
e64fa520 20#include <sys/dir.h>
10d665ef 21#include <utmp.h>
080a6cff 22#include <sys/time.h>
10d665ef 23#include <signal.h>
10d665ef
BJ
24#include <fstab.h>
25
b6407c9d
KM
26#define MWORD(m,i) (m[(unsigned)(i-1)/NBBY])
27#define MBIT(i) (1<<((unsigned)(i-1)%NBBY))
10d665ef
BJ
28#define BIS(i,w) (MWORD(w,i) |= MBIT(i))
29#define BIC(i,w) (MWORD(w,i) &= ~MBIT(i))
30#define BIT(i,w) (MWORD(w,i) & MBIT(i))
31
b6407c9d
KM
32int msiz;
33char *clrmap;
34char *dirmap;
35char *nodmap;
10d665ef
BJ
36
37/*
38 * All calculations done in 0.1" units!
39 */
40
41char *disk; /* name of the disk file */
42char *tape; /* name of the tape file */
43char *increm; /* name of the file containing incremental information*/
a98111df
SL
44char *temp; /* name of the file for doing rewrite of increm */
45char lastincno; /* increment number of previous dump */
10d665ef
BJ
46char incno; /* increment number */
47int uflag; /* update flag */
48int fi; /* disk file descriptor */
49int to; /* tape file descriptor */
a47b7e40 50int pipeout; /* true => output to standard output */
10d665ef
BJ
51ino_t ino; /* current inumber; used globally */
52int nsubdir;
53int newtape; /* new tape flag */
54int nadded; /* number of added sub directories */
55int dadded; /* directory added flag */
56int density; /* density in 0.1" units */
57long tsize; /* tape size in 0.1" units */
58long esize; /* estimated tape size, blocks */
59long asize; /* number of 0.1" units written on current tape */
60int etapes; /* estimated number of tapes */
61
62int notify; /* notify operator flag */
63int blockswritten; /* number of blocks written on current tape */
64int tapeno; /* current tape number */
65time_t tstart_writing; /* when started writing the first tape block */
66char *processname;
b6407c9d
KM
67struct fs *sblock; /* the file system super block */
68char buf[MAXBSIZE];
72e64d31 69long dev_bsize;
10d665ef
BJ
70
71char *ctime();
72char *prdate();
73long atol();
74int mark();
75int add();
7b0c1d85 76int dirdump();
10d665ef
BJ
77int dump();
78int tapsrec();
79int dmpspc();
80int dsrch();
81int nullf();
82char *getsuffix();
83char *rawname();
003a2a9e 84struct dinode *getino();
10d665ef
BJ
85
86int interrupt(); /* in case operator bangs on console */
87
88#define HOUR (60L*60L)
89#define DAY (24L*HOUR)
90#define YEAR (365L*DAY)
91
92/*
93 * Exit status codes
94 */
8e319182 95#define X_FINOK 0 /* normal exit */
10d665ef
BJ
96#define X_REWRITE 2 /* restart writing from the check point */
97#define X_ABORT 3 /* abort all of dump; don't attempt checkpointing*/
98
10d665ef 99#define NINCREM "/etc/dumpdates" /*new format incremental info*/
a98111df 100#define TEMP "/etc/dtmp" /*output temp file*/
10d665ef
BJ
101
102#define TAPE "/dev/rmt8" /* default tape device */
103#define DISK "/dev/rrp1g" /* default disk */
104#define OPGRENT "operator" /* group entry to notify */
105#define DIALUP "ttyd" /* prefix for dialups */
106
10d665ef 107struct fstab *fstabsearch(); /* search in fs_file and fs_spec */
10d665ef
BJ
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();