]>
git.wh0rd.org - dump.git/blob - dump/dump.h
73882dc6795980e047567e4814e62e62812d4c01
2 * Ported to Linux's Second Extended File System as part of the
3 * dump and restore backup suit
4 * Remy Card <card@Linux.EU.Org>, 1994, 1995, 1996
9 * Copyright (c) 1980, 1993
10 * The Regents of the University of California. All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. All advertising materials mentioning features or use of this software
21 * must display the following acknowledgement:
22 * This product includes software developed by the University of
23 * California, Berkeley and its contributors.
24 * 4. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * @(#)dump.h 8.2 (Berkeley) 4/28/95
43 #define MAXINOPB (MAXBSIZE / sizeof(struct dinode))
44 #define MAXNINDIR (MAXBSIZE / sizeof(daddr_t))
47 * Dump maps used to describe what is to be dumped.
49 int mapsize
; /* size of the state maps */
50 char *usedinomap
; /* map of allocated inodes */
51 char *dumpdirmap
; /* map of directories to be dumped */
52 char *dumpinomap
; /* map of files to be dumped */
54 * Map manipulation macros.
56 #define SETINO(ino, map) \
57 map[(u_int)((ino) - 1) / NBBY] |= 1 << ((u_int)((ino) - 1) % NBBY)
58 #define CLRINO(ino, map) \
59 map[(u_int)((ino) - 1) / NBBY] &= ~(1 << ((u_int)((ino) - 1) % NBBY))
60 #define TSTINO(ino, map) \
61 (map[(u_int)((ino) - 1) / NBBY] & (1 << ((u_int)((ino) - 1) % NBBY)))
64 * All calculations done in 0.1" units!
66 char *disk
; /* name of the disk file */
67 char *tape
; /* name of the tape file */
68 char *dumpdates
; /* name of the file containing dump date information*/
69 char *temp
; /* name of the file for doing rewrite of dumpdates */
70 char lastlevel
; /* dump level of previous dump */
71 char level
; /* dump level of this dump */
72 int uflag
; /* update flag */
73 int diskfd
; /* disk file descriptor */
74 int tapefd
; /* tape file descriptor */
75 int pipeout
; /* true => output to standard output */
76 ino_t curino
; /* current inumber; used globally */
77 int newtape
; /* new tape flag */
78 int density
; /* density in 0.1" units */
79 long tapesize
; /* estimated tape size, blocks */
80 long tsize
; /* tape size in 0.1" units */
81 long asize
; /* number of 0.1" units written on current tape */
82 int etapes
; /* estimated number of tapes */
83 int nonodump
; /* if set, do not honor UF_NODUMP user flags */
85 int notify
; /* notify operator flag */
86 int blockswritten
; /* number of blocks written on current tape */
87 int tapeno
; /* current tape number */
88 time_t tstart_writing
; /* when started writing the first tape block */
90 time_t tend_writing
; /* after writing the last tape block */
93 struct fs
*sblock
; /* the file system super block */
94 char sblock_buf
[MAXBSIZE
];
96 long dev_bsize
; /* block size of underlying disk device */
97 int dev_bshift
; /* log2(dev_bsize) */
98 int tp_bshift
; /* log2(TP_BSIZE) */
101 #include <sys/cdefs.h>
104 /* operator interface functions */
105 void broadcast
__P((char *message
));
106 void lastdump
__P((int arg
)); /* int should be char */
107 void msg
__P((const char *fmt
, ...));
108 void msgtail
__P((const char *fmt
, ...));
109 int query
__P((char *question
));
110 void quit
__P((const char *fmt
, ...));
111 void set_operators
__P((void));
112 void timeest
__P((void));
113 time_t unctime
__P((char *str
));
115 /* mapping rouintes */
117 long blockest
__P((struct dinode
*dp
));
118 int mapfiles
__P((ino_t maxino
, long *tapesize
));
120 int mapfilesfromdir
__P((ino_t maxino
, long *tapesize
, char *directory
));
122 int mapdirs
__P((ino_t maxino
, long *tapesize
));
124 /* file dumping routines */
125 void blksout
__P((daddr_t
*blkp
, int frags
, ino_t ino
));
126 void bread
__P((daddr_t blkno
, char *buf
, int size
));
127 void dumpino
__P((struct dinode
*dp
, ino_t ino
));
129 void dumpdirino
__P((struct dinode
*dp
, ino_t ino
));
131 void dumpmap
__P((char *map
, int type
, ino_t ino
));
132 void writeheader
__P((ino_t ino
));
134 /* tape writing routines */
135 int alloctape
__P((void));
136 void close_rewind
__P((void));
137 void dumpblock
__P((daddr_t blkno
, int size
));
138 void startnewtape
__P((int top
));
139 void trewind
__P((void));
140 void writerec
__P((char *dp
, int isspcl
));
142 __dead
void Exit
__P((int status
));
143 void dumpabort
__P((int signo
));
144 void getfstab
__P((void));
146 char *rawname
__P((char *cp
));
147 struct dinode
*getino
__P((ino_t inum
));
151 void rmtclose
__P((void));
152 int rmthost
__P((char *host
));
153 int rmtopen
__P((char *tape
, int mode
));
154 int rmtwrite
__P((char *buf
, int count
));
157 void interrupt
__P((int signo
)); /* in case operator bangs on console */
162 #define X_FINOK 0 /* normal exit */
163 #define X_REWRITE 2 /* restart writing from the check point */
164 #define X_ABORT 3 /* abort dump; don't attempt checkpointing */
166 #define OPGRENT "operator" /* group entry to notify */
168 #define DIALUP "ttyS" /* prefix for dialups */
170 #define DIALUP "ttyd" /* prefix for dialups */
173 struct fstab
*fstabsearch
__P((char *key
)); /* search fs_file and fs_spec */
175 struct fstab
*fstabsearchdir
__P((char *key
, char *dir
)); /* search fs_file and fs_spec */
183 * The contents of the file _PATH_DUMPDATES is maintained both on
184 * a linked list, and then (eventually) arrayified.
187 char dd_name
[NAME_MAX
+3];
192 struct dumpdates dt_value
;
193 struct dumptime
*dt_next
;
195 struct dumptime
*dthead
; /* head of the list version */
196 int nddates
; /* number of records (might be zero) */
197 int ddates_in
; /* we have read the increment file */
198 struct dumpdates
**ddatev
; /* the arrayfied version */
199 void initdumptimes
__P((void));
200 void getdumptime
__P((void));
201 void putdumptime
__P((void));
202 #define ITITERATE(i, ddp) \
203 for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
205 void sig
__P((int signo
));
208 * Compatibility with old systems.
211 #include <sys/file.h>
212 #define strchr(a,b) index(a,b)
213 #define strrchr(a,b) rindex(a,b)
214 extern char *strdup(), *ctime();
215 extern int read(), write();
220 #define DUMP_CURRENT_REV 0
225 #define _PATH_UTMP "/etc/utmp"
228 #define _PATH_FSTAB "/etc/fstab"
233 extern char *calloc();
234 extern char *malloc();
236 extern char *strcpy();
237 extern char *strncpy();
238 extern char *strcat();
239 extern time_t time();
240 extern void endgrent();
241 extern __dead
void exit();
242 extern off_t
lseek();
243 extern const char *strerror();