fixed setjmp/longjmp to save/restore the floating point masks (control word)
[unix-history] / sbin / dump / dump.h
CommitLineData
15637ed4
RG
1/*-
2 * Copyright (c) 1980 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)dump.h 5.16 (Berkeley) 5/29/91
b16a1b0e
JH
34 *
35 * $Header: /b/source/CVS/src/sbin/dump/dump.h,v 1.3 1993/03/23 00:27:03 cgd Exp $
15637ed4
RG
36 */
37
38#define MAXINOPB (MAXBSIZE / sizeof(struct dinode))
39#define MAXNINDIR (MAXBSIZE / sizeof(daddr_t))
40
41/*
42 * Dump maps used to describe what is to be dumped.
43 */
44int mapsize; /* size of the state maps */
45char *usedinomap; /* map of allocated inodes */
46char *dumpdirmap; /* map of directories to be dumped */
47char *dumpinomap; /* map of files to be dumped */
48/*
49 * Map manipulation macros.
50 */
51#define SETINO(ino, map) \
52 map[(u_int)((ino) - 1) / NBBY] |= 1 << ((u_int)((ino) - 1) % NBBY)
53#define CLRINO(ino, map) \
54 map[(u_int)((ino) - 1) / NBBY] &= ~(1 << ((u_int)((ino) - 1) % NBBY))
55#define TSTINO(ino, map) \
56 (map[(u_int)((ino) - 1) / NBBY] & (1 << ((u_int)((ino) - 1) % NBBY)))
57
58/*
59 * All calculations done in 0.1" units!
60 */
61char *disk; /* name of the disk file */
62char *tape; /* name of the tape file */
63char *dumpdates; /* name of the file containing dump date information*/
64char *temp; /* name of the file for doing rewrite of dumpdates */
65char lastlevel; /* dump level of previous dump */
66char level; /* dump level of this dump */
67int uflag; /* update flag */
68int diskfd; /* disk file descriptor */
69int tapefd; /* tape file descriptor */
70int pipeout; /* true => output to standard output */
71ino_t curino; /* current inumber; used globally */
72int newtape; /* new tape flag */
73int density; /* density in 0.1" units */
74long tapesize; /* estimated tape size, blocks */
75long tsize; /* tape size in 0.1" units */
76long asize; /* number of 0.1" units written on current tape */
77int etapes; /* estimated number of tapes */
78
79int notify; /* notify operator flag */
80int blockswritten; /* number of blocks written on current tape */
81int tapeno; /* current tape number */
82time_t tstart_writing; /* when started writing the first tape block */
83char *processname;
84struct fs *sblock; /* the file system super block */
85char buf[MAXBSIZE];
86long dev_bsize; /* block size of underlying disk device */
87int dev_bshift; /* log2(dev_bsize) */
88int tp_bshift; /* log2(TP_BSIZE) */
89
90/* operator interface functions */
91void broadcast();
92void lastdump();
93void msg();
94void msgtail();
95int query();
96void set_operators();
97void timeest();
98
99/* mapping rouintes */
100long blockest();
101int mapfiles();
102int mapdirs();
103
104/* file dumping routines */
105void dirdump();
106void blksout();
107void dumpmap();
108void writeheader();
109void bread();
110
111/* tape writing routines */
112int alloctape();
113void writerec();
114void dumpblock();
115void flushtape();
116void trewind();
117void close_rewind();
118void startnewtape();
119
120void dumpabort();
121void Exit();
122void getfstab();
123void quit();
124
125char *rawname();
126struct dinode *getino();
127
128void interrupt(); /* in case operator bangs on console */
129
130/*
131 * Exit status codes
132 */
133#define X_FINOK 0 /* normal exit */
134#define X_REWRITE 2 /* restart writing from the check point */
135#define X_ABORT 3 /* abort all of dump; don't attempt checkpointing*/
136
137#define OPGRENT "operator" /* group entry to notify */
138#define DIALUP "ttyd" /* prefix for dialups */
139
140struct fstab *fstabsearch(); /* search in fs_file and fs_spec */
141
142/*
143 * The contents of the file _PATH_DUMPDATES is maintained both on
144 * a linked list, and then (eventually) arrayified.
145 */
146struct dumpdates {
147 char dd_name[MAXNAMLEN+3];
148 char dd_level;
149 time_t dd_ddate;
150};
151struct dumptime {
152 struct dumpdates dt_value;
153 struct dumptime *dt_next;
154};
155struct dumptime *dthead; /* head of the list version */
156int nddates; /* number of records (might be zero) */
157int ddates_in; /* we have read the increment file */
158struct dumpdates **ddatev; /* the arrayfied version */
159void initdumptimes();
160void getdumptime();
161void putdumptime();
162#define ITITERATE(i, ddp) \
163 for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
164
165/*
166 * We catch these interrupts
167 */
168void sighup();
169void sigquit();
170void sigill();
171void sigtrap();
172void sigfpe();
173void sigkill();
174void sigbus();
175void sigsegv();
176void sigsys();
177void sigalrm();
178void sigterm();
179
180/*
181 * Compatibility with old systems.
182 */
183#ifndef __STDC__
184#include <sys/file.h>
185#define _PATH_FSTAB "/etc/fstab"
186extern char *index(), *strdup();
187extern char *ctime();
188extern int errno;
189#endif