xref: /original-bsd/old/dump.4.1/dump.h (revision 708ba973)
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  *
6  *	@(#)dump.h	5.1 (Berkeley) 06/05/85
7  */
8 
9 #define	NI	16
10 #define	DIRPB	(BSIZE/sizeof(struct direct))
11 
12 #include <stdio.h>
13 #include <ctype.h>
14 #include <fstab.h>
15 #include <signal.h>
16 #include <utmp.h>
17 #include "include.4.1/sys/param.h"
18 #include "include.4.1/sys/stat.h"
19 #include "include.4.1/sys/filsys.h"
20 #include "include.4.1/sys/ino.h"
21 #include "include.4.1/sys/inode.h"
22 #include "include.4.1/sys/fblk.h"
23 #include "include.4.1/sys/dir.h"
24 #include "include.4.1/time.h"
25 #include "include.4.1/dumprestor.h"
26 
27 #define	MWORD(m,i)	(m[(unsigned)(i-1)/MLEN])
28 #define	MBIT(i)		(1<<((unsigned)(i-1)%MLEN))
29 #define	BIS(i,w)	(MWORD(w,i) |=  MBIT(i))
30 #define	BIC(i,w)	(MWORD(w,i) &= ~MBIT(i))
31 #define	BIT(i,w)	(MWORD(w,i) & MBIT(i))
32 
33 short	clrmap[MSIZ];
34 short	dirmap[MSIZ];
35 short	nodmap[MSIZ];
36 
37 /*
38  *	All calculations done in 0.1" units!
39  */
40 
41 char	*disk;		/* name of the disk file */
42 char	*tape;		/* name of the tape file */
43 char	pipeout;	/* true => output to standard output */
44 char	*increm;	/* name of the file containing incremental information*/
45 char	incno;		/* increment number */
46 int	uflag;		/* update flag */
47 int	fi;		/* disk file descriptor */
48 int	to;		/* tape file descriptor */
49 ino_t	ino;		/* current inumber; used globally */
50 int	nsubdir;
51 int	newtape;	/* new tape flag */
52 int	nadded;		/* number of added sub directories */
53 int	dadded;		/* directory added flag */
54 int	density;	/* density in 0.1" units */
55 long	tsize;		/* tape size in 0.1" units */
56 long	esize;		/* estimated tape size, blocks */
57 long	asize;		/* number of 0.1" units written on current tape */
58 int	etapes;		/* estimated number of tapes */
59 
60 int	notify;		/* notify operator flag */
61 int	blockswritten;	/* number of blocks written on current tape */
62 int	tapeno;		/* current tape number */
63 time_t	tstart_writing;	/* when started writing the first tape block */
64 char	*processname;
65 
66 char	*ctime();
67 char	*prdate();
68 long	atol();
69 int	mark();
70 int	add();
71 int	dump();
72 int	tapsrec();
73 int	dmpspc();
74 int	dsrch();
75 int	nullf();
76 char	*getsuffix();
77 char	*rawname();
78 
79 int	interrupt();		/* in case operator bangs on console */
80 
81 #define	HOUR	(60L*60L)
82 #define	DAY	(24L*HOUR)
83 #define	YEAR	(365L*DAY)
84 
85 /*
86  *	Exit status codes
87  */
88 #define	X_FINOK		1	/* normal exit */
89 #define	X_REWRITE	2	/* restart writing from the check point */
90 #define	X_ABORT		3	/* abort all of dump; don't attempt checkpointing*/
91 
92 #ifdef DEBUG
93 #define	OINCREM	"./ddate"		/*old format incremental info*/
94 #define	NINCREM	"./dumpdates"		/*new format incremental info*/
95 #else not DEBUG
96 #define	OINCREM	"/etc/ddate"		/*old format incremental info*/
97 #define	NINCREM	"/etc/dumpdates"	/*new format incremental info*/
98 #endif
99 
100 #define	TAPE	"/dev/rmt8"		/* default tape device */
101 #define	DISK	"/dev/rrp1g"		/* default disk */
102 #define	OPGRENT	"operator"		/* group entry to notify */
103 #define DIALUP	"ttyd"			/* prefix for dialups */
104 
105 struct	fstab	*fstabsearch();	/* search in fs_file and fs_spec */
106 
107 /*
108  *	The contents of the file NINCREM is maintained both on
109  *	a linked list, and then (eventually) arrayified.
110  */
111 struct	itime{
112 	struct	idates	it_value;
113 	struct	itime	*it_next;
114 };
115 struct	itime	*ithead;	/* head of the list version */
116 int	nidates;		/* number of records (might be zero) */
117 int	idates_in;		/* we have read the increment file */
118 struct	idates	**idatev;	/* the arrayfied version */
119 #define	ITITERATE(i, ip) for (i = 0,ip = idatev[0]; i < nidates; i++, ip = idatev[i])
120 
121 /*
122  *	We catch these interrupts
123  */
124 int	sighup();
125 int	sigquit();
126 int	sigill();
127 int	sigtrap();
128 int	sigfpe();
129 int	sigkill();
130 int	sigbus();
131 int	sigsegv();
132 int	sigsys();
133 int	sigalrm();
134 int	sigterm();
135