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