xref: /csrg-svn/sbin/dump/dump.h (revision 50643)
147082Smckusick /*-
247082Smckusick  * Copyright (c) 1980 The Regents of the University of California.
347082Smckusick  * All rights reserved.
422043Sdist  *
547082Smckusick  * %sccs.include.redist.c%
647082Smckusick  *
7*50643Storek  *	@(#)dump.h	5.18 (Berkeley) 07/29/91
822043Sdist  */
913592Ssam 
105328Smckusic #define MAXINOPB	(MAXBSIZE / sizeof(struct dinode))
115328Smckusic #define MAXNINDIR	(MAXBSIZE / sizeof(daddr_t))
121421Sroot 
1346790Smckusick /*
1446790Smckusick  * Dump maps used to describe what is to be dumped.
1546790Smckusick  */
1646790Smckusick int	mapsize;	/* size of the state maps */
1746790Smckusick char	*usedinomap;	/* map of allocated inodes */
1846790Smckusick char	*dumpdirmap;	/* map of directories to be dumped */
1946790Smckusick char	*dumpinomap;	/* map of files to be dumped */
2046790Smckusick /*
2146790Smckusick  * Map manipulation macros.
2246790Smckusick  */
2346790Smckusick #define	SETINO(ino, map) \
2446790Smckusick 	map[(u_int)((ino) - 1) / NBBY] |=  1 << ((u_int)((ino) - 1) % NBBY)
2546790Smckusick #define	CLRINO(ino, map) \
2646790Smckusick 	map[(u_int)((ino) - 1) / NBBY] &=  ~(1 << ((u_int)((ino) - 1) % NBBY))
2746790Smckusick #define	TSTINO(ino, map) \
2846790Smckusick 	(map[(u_int)((ino) - 1) / NBBY] &  (1 << ((u_int)((ino) - 1) % NBBY)))
291421Sroot 
301421Sroot /*
311421Sroot  *	All calculations done in 0.1" units!
321421Sroot  */
331421Sroot char	*disk;		/* name of the disk file */
341421Sroot char	*tape;		/* name of the tape file */
3546790Smckusick char	*dumpdates;	/* name of the file containing dump date information*/
3646790Smckusick char	*temp;		/* name of the file for doing rewrite of dumpdates */
3746790Smckusick char	lastlevel;	/* dump level of previous dump */
3846790Smckusick char	level;		/* dump level of this dump */
391421Sroot int	uflag;		/* update flag */
4046790Smckusick int	diskfd;		/* disk file descriptor */
4146790Smckusick int	tapefd;		/* tape file descriptor */
4212331Smckusick int	pipeout;	/* true => output to standard output */
4346790Smckusick ino_t	curino;		/* current inumber; used globally */
441421Sroot int	newtape;	/* new tape flag */
451421Sroot int	density;	/* density in 0.1" units */
4646790Smckusick long	tapesize;	/* estimated tape size, blocks */
471421Sroot long	tsize;		/* tape size in 0.1" units */
481421Sroot long	asize;		/* number of 0.1" units written on current tape */
491421Sroot int	etapes;		/* estimated number of tapes */
501421Sroot 
511421Sroot int	notify;		/* notify operator flag */
521421Sroot int	blockswritten;	/* number of blocks written on current tape */
531421Sroot int	tapeno;		/* current tape number */
541421Sroot time_t	tstart_writing;	/* when started writing the first tape block */
551421Sroot char	*processname;
5646790Smckusick struct	fs *sblock;	/* the file system super block */
575328Smckusic char	buf[MAXBSIZE];
5846589Storek long	dev_bsize;	/* block size of underlying disk device */
5946589Storek int	dev_bshift;	/* log2(dev_bsize) */
6046589Storek int	tp_bshift;	/* log2(TP_BSIZE) */
611421Sroot 
6246589Storek /* operator interface functions */
6346589Storek void	broadcast();
6446589Storek void	lastdump();
65*50643Storek #if __STDC__
66*50643Storek void	msg(const char *fmt, ...);
67*50643Storek void	msgtail(const char *fmt, ...);
68*50643Storek void	quit(const char *fmt, ...);
69*50643Storek #else
7046589Storek void	msg();
7146589Storek void	msgtail();
72*50643Storek void	quit();
73*50643Storek #endif
7446589Storek int	query();
7546589Storek void	set_operators();
7646589Storek void	timeest();
7746589Storek 
7846589Storek /* mapping rouintes */
7946790Smckusick long	blockest();
8046790Smckusick int	mapfiles();
8146790Smckusick int	mapdirs();
8246589Storek 
8346589Storek /* file dumping routines */
8446589Storek void	dirdump();
8546589Storek void	blksout();
8646790Smckusick void	dumpmap();
8746790Smckusick void	writeheader();
8846589Storek void	bread();
8946589Storek 
9046589Storek /* tape writing routines */
9146589Storek int	alloctape();
9246790Smckusick void	writerec();
9346790Smckusick void	dumpblock();
9446790Smckusick void	flushtape();
9546589Storek void	trewind();
9646589Storek void	close_rewind();
9746790Smckusick void	startnewtape();
9846589Storek 
9946589Storek void	dumpabort();
10046589Storek void	Exit();
10146589Storek void	getfstab();
10246589Storek 
1031421Sroot char	*rawname();
1044701Smckusic struct dinode *getino();
1051421Sroot 
10646589Storek void	interrupt();		/* in case operator bangs on console */
1071421Sroot 
1081421Sroot /*
1091421Sroot  *	Exit status codes
1101421Sroot  */
11128641Smckusick #define	X_FINOK		0	/* normal exit */
1121421Sroot #define	X_REWRITE	2	/* restart writing from the check point */
1131421Sroot #define	X_ABORT		3	/* abort all of dump; don't attempt checkpointing*/
1141421Sroot 
1151421Sroot #define	OPGRENT	"operator"		/* group entry to notify */
1161421Sroot #define DIALUP	"ttyd"			/* prefix for dialups */
1171421Sroot 
1181421Sroot struct	fstab	*fstabsearch();	/* search in fs_file and fs_spec */
1191421Sroot 
1201421Sroot /*
12137266Sbostic  *	The contents of the file _PATH_DUMPDATES is maintained both on
1221421Sroot  *	a linked list, and then (eventually) arrayified.
1231421Sroot  */
12446790Smckusick struct dumpdates {
12550506Smckusick 	char	dd_name[NAME_MAX+3];
12646790Smckusick 	char	dd_level;
12746790Smckusick 	time_t	dd_ddate;
1288375Smckusick };
12946790Smckusick struct dumptime {
13046790Smckusick 	struct	dumpdates dt_value;
13146790Smckusick 	struct	dumptime *dt_next;
1321421Sroot };
13346790Smckusick struct	dumptime *dthead;	/* head of the list version */
13446790Smckusick int	nddates;		/* number of records (might be zero) */
13546790Smckusick int	ddates_in;		/* we have read the increment file */
13646790Smckusick struct	dumpdates **ddatev;	/* the arrayfied version */
13746790Smckusick void	initdumptimes();
13846790Smckusick void	getdumptime();
13946790Smckusick void	putdumptime();
14046790Smckusick #define	ITITERATE(i, ddp) \
14146790Smckusick 	for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
1421421Sroot 
1431421Sroot /*
1441421Sroot  *	We catch these interrupts
1451421Sroot  */
14646589Storek void	sighup();
14746589Storek void	sigquit();
14846589Storek void	sigill();
14946589Storek void	sigtrap();
15046589Storek void	sigfpe();
15146589Storek void	sigkill();
15246589Storek void	sigbus();
15346589Storek void	sigsegv();
15446589Storek void	sigsys();
15546589Storek void	sigalrm();
15646589Storek void	sigterm();
15746807Smckusick 
15846807Smckusick /*
15946807Smckusick  * Compatibility with old systems.
16046807Smckusick  */
16146807Smckusick #ifndef __STDC__
16246807Smckusick #include <sys/file.h>
16346807Smckusick #define _PATH_FSTAB	"/etc/fstab"
16449932Smckusick extern char *index(), *strdup();
16546807Smckusick extern char *ctime();
16646807Smckusick extern int errno;
16746807Smckusick #endif
168