1994-05-26 06:35:07 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1980, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1997-03-11 12:09:50 +00:00
|
|
|
* @(#)dump.h 8.2 (Berkeley) 4/28/95
|
2001-01-29 09:45:51 +00:00
|
|
|
*
|
|
|
|
* $FreeBSD$
|
1994-05-26 06:35:07 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Dump maps used to describe what is to be dumped.
|
|
|
|
*/
|
|
|
|
int mapsize; /* size of the state maps */
|
|
|
|
char *usedinomap; /* map of allocated inodes */
|
|
|
|
char *dumpdirmap; /* map of directories to be dumped */
|
|
|
|
char *dumpinomap; /* map of files to be dumped */
|
|
|
|
/*
|
|
|
|
* Map manipulation macros.
|
|
|
|
*/
|
|
|
|
#define SETINO(ino, map) \
|
2002-09-25 04:06:37 +00:00
|
|
|
map[(u_int)((ino) - 1) / CHAR_BIT] |= \
|
|
|
|
1 << ((u_int)((ino) - 1) % CHAR_BIT)
|
1994-05-26 06:35:07 +00:00
|
|
|
#define CLRINO(ino, map) \
|
2002-09-25 04:06:37 +00:00
|
|
|
map[(u_int)((ino) - 1) / CHAR_BIT] &= \
|
|
|
|
~(1 << ((u_int)((ino) - 1) % CHAR_BIT))
|
1994-05-26 06:35:07 +00:00
|
|
|
#define TSTINO(ino, map) \
|
2002-09-25 04:06:37 +00:00
|
|
|
(map[(u_int)((ino) - 1) / CHAR_BIT] & \
|
|
|
|
(1 << ((u_int)((ino) - 1) % CHAR_BIT)))
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* All calculations done in 0.1" units!
|
|
|
|
*/
|
|
|
|
char *disk; /* name of the disk file */
|
|
|
|
char *tape; /* name of the tape file */
|
|
|
|
char *dumpdates; /* name of the file containing dump date information*/
|
|
|
|
char *temp; /* name of the file for doing rewrite of dumpdates */
|
|
|
|
char lastlevel; /* dump level of previous dump */
|
|
|
|
char level; /* dump level of this dump */
|
|
|
|
int uflag; /* update flag */
|
|
|
|
int diskfd; /* disk file descriptor */
|
|
|
|
int tapefd; /* tape file descriptor */
|
|
|
|
int pipeout; /* true => output to standard output */
|
|
|
|
ino_t curino; /* current inumber; used globally */
|
|
|
|
int newtape; /* new tape flag */
|
|
|
|
int density; /* density in 0.1" units */
|
|
|
|
long tapesize; /* estimated tape size, blocks */
|
|
|
|
long tsize; /* tape size in 0.1" units */
|
|
|
|
long asize; /* number of 0.1" units written on current tape */
|
|
|
|
int etapes; /* estimated number of tapes */
|
|
|
|
int nonodump; /* if set, do not honor UF_NODUMP user flags */
|
1997-02-01 23:44:19 +00:00
|
|
|
int unlimited; /* if set, write to end of medium */
|
2003-01-13 19:42:41 +00:00
|
|
|
int cachesize; /* size of block cache in bytes */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
int notify; /* notify operator flag */
|
|
|
|
int blockswritten; /* number of blocks written on current tape */
|
|
|
|
int tapeno; /* current tape number */
|
|
|
|
time_t tstart_writing; /* when started writing the first tape block */
|
1995-11-18 18:00:43 +00:00
|
|
|
time_t tend_writing; /* after writing the last tape block */
|
2002-02-16 21:05:16 +00:00
|
|
|
int passno; /* current dump pass number */
|
2002-08-21 18:11:48 +00:00
|
|
|
struct fs *sblock; /* the file system super block */
|
1994-05-26 06:35:07 +00:00
|
|
|
char sblock_buf[MAXBSIZE];
|
|
|
|
long dev_bsize; /* block size of underlying disk device */
|
|
|
|
int dev_bshift; /* log2(dev_bsize) */
|
|
|
|
int tp_bshift; /* log2(TP_BSIZE) */
|
|
|
|
|
|
|
|
/* operator interface functions */
|
2002-03-20 22:49:40 +00:00
|
|
|
void broadcast(const char *message);
|
|
|
|
void infosch(int);
|
|
|
|
void lastdump(int arg); /* int should be char */
|
|
|
|
void msg(const char *fmt, ...) __printflike(1, 2);
|
|
|
|
void msgtail(const char *fmt, ...) __printflike(1, 2);
|
|
|
|
int query(const char *question);
|
|
|
|
void quit(const char *fmt, ...) __printflike(1, 2);
|
|
|
|
void timeest(void);
|
|
|
|
time_t unctime(char *str);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/* mapping rouintes */
|
2002-06-21 06:18:05 +00:00
|
|
|
union dinode;
|
2002-03-20 22:49:40 +00:00
|
|
|
int mapfiles(ino_t maxino, long *tapesize);
|
|
|
|
int mapdirs(ino_t maxino, long *tapesize);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/* file dumping routines */
|
2002-06-21 06:18:05 +00:00
|
|
|
void ufs1_blksout(ufs1_daddr_t *blkp, int frags, ino_t ino);
|
|
|
|
void ufs2_blksout(ufs2_daddr_t *blkp, int frags, ino_t ino);
|
|
|
|
void bread(ufs2_daddr_t blkno, char *buf, int size);
|
|
|
|
void dumpino(union dinode *dp, ino_t ino);
|
2002-03-20 22:49:40 +00:00
|
|
|
void dumpmap(char *map, int type, ino_t ino);
|
|
|
|
void writeheader(ino_t ino);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/* tape writing routines */
|
2002-03-20 22:49:40 +00:00
|
|
|
int alloctape(void);
|
|
|
|
void close_rewind(void);
|
2002-06-21 06:18:05 +00:00
|
|
|
void dumpblock(ufs2_daddr_t blkno, int size);
|
2002-03-20 22:49:40 +00:00
|
|
|
void startnewtape(int top);
|
|
|
|
void trewind(void);
|
|
|
|
void writerec(char *dp, int isspcl);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2002-03-20 22:49:40 +00:00
|
|
|
void Exit(int status) __dead2;
|
|
|
|
void dumpabort(int signo);
|
2003-04-07 11:34:12 +00:00
|
|
|
void dump_getfstab(void);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2002-03-20 22:49:40 +00:00
|
|
|
char *rawname(char *cp);
|
2002-06-21 06:18:05 +00:00
|
|
|
union dinode *getino(ino_t inum, int *mode);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/* rdump routines */
|
|
|
|
#ifdef RDUMP
|
2002-03-20 22:49:40 +00:00
|
|
|
void rmtclose(void);
|
|
|
|
int rmthost(const char *host);
|
|
|
|
int rmtopen(const char *tape, int mode);
|
|
|
|
int rmtwrite(const char *buf, int count);
|
1994-05-26 06:35:07 +00:00
|
|
|
#endif /* RDUMP */
|
|
|
|
|
2002-03-20 22:49:40 +00:00
|
|
|
void interrupt(int signo); /* in case operator bangs on console */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Exit status codes
|
|
|
|
*/
|
|
|
|
#define X_FINOK 0 /* normal exit */
|
1998-07-14 09:19:47 +00:00
|
|
|
#define X_STARTUP 1 /* startup error */
|
1994-05-26 06:35:07 +00:00
|
|
|
#define X_REWRITE 2 /* restart writing from the check point */
|
|
|
|
#define X_ABORT 3 /* abort dump; don't attempt checkpointing */
|
|
|
|
|
|
|
|
#define OPGRENT "operator" /* group entry to notify */
|
|
|
|
|
2002-03-20 22:49:40 +00:00
|
|
|
struct fstab *fstabsearch(const char *key); /* search fs_file and fs_spec */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
#ifndef NAME_MAX
|
|
|
|
#define NAME_MAX 255
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The contents of the file _PATH_DUMPDATES is maintained both on
|
|
|
|
* a linked list, and then (eventually) arrayified.
|
|
|
|
*/
|
|
|
|
struct dumpdates {
|
|
|
|
char dd_name[NAME_MAX+3];
|
|
|
|
char dd_level;
|
|
|
|
time_t dd_ddate;
|
|
|
|
};
|
|
|
|
int nddates; /* number of records (might be zero) */
|
|
|
|
int ddates_in; /* we have read the increment file */
|
|
|
|
struct dumpdates **ddatev; /* the arrayfied version */
|
2002-03-20 22:49:40 +00:00
|
|
|
void initdumptimes(void);
|
|
|
|
void getdumptime(void);
|
|
|
|
void putdumptime(void);
|
1994-05-26 06:35:07 +00:00
|
|
|
#define ITITERATE(i, ddp) \
|
|
|
|
for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
|
|
|
|
|
2002-03-20 22:49:40 +00:00
|
|
|
void sig(int signo);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
#ifndef _PATH_FSTAB
|
|
|
|
#define _PATH_FSTAB "/etc/fstab"
|
|
|
|
#endif
|