xref: /csrg-svn/sbin/dump/dump.h (revision 49932)
147082Smckusick /*-
247082Smckusick  * Copyright (c) 1980 The Regents of the University of California.
347082Smckusick  * All rights reserved.
422043Sdist  *
547082Smckusick  * %sccs.include.redist.c%
647082Smckusick  *
7*49932Smckusick  *	@(#)dump.h	5.16 (Berkeley) 05/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();
6546589Storek void	msg();
6646589Storek void	msgtail();
6746589Storek int	query();
6846589Storek void	set_operators();
6946589Storek void	timeest();
7046589Storek 
7146589Storek /* mapping rouintes */
7246790Smckusick long	blockest();
7346790Smckusick int	mapfiles();
7446790Smckusick int	mapdirs();
7546589Storek 
7646589Storek /* file dumping routines */
7746589Storek void	dirdump();
7846589Storek void	blksout();
7946790Smckusick void	dumpmap();
8046790Smckusick void	writeheader();
8146589Storek void	bread();
8246589Storek 
8346589Storek /* tape writing routines */
8446589Storek int	alloctape();
8546790Smckusick void	writerec();
8646790Smckusick void	dumpblock();
8746790Smckusick void	flushtape();
8846589Storek void	trewind();
8946589Storek void	close_rewind();
9046790Smckusick void	startnewtape();
9146589Storek 
9246589Storek void	dumpabort();
9346589Storek void	Exit();
9446589Storek void	getfstab();
9546589Storek void	quit();
9646589Storek 
971421Sroot char	*rawname();
984701Smckusic struct dinode *getino();
991421Sroot 
10046589Storek void	interrupt();		/* in case operator bangs on console */
1011421Sroot 
1021421Sroot /*
1031421Sroot  *	Exit status codes
1041421Sroot  */
10528641Smckusick #define	X_FINOK		0	/* normal exit */
1061421Sroot #define	X_REWRITE	2	/* restart writing from the check point */
1071421Sroot #define	X_ABORT		3	/* abort all of dump; don't attempt checkpointing*/
1081421Sroot 
1091421Sroot #define	OPGRENT	"operator"		/* group entry to notify */
1101421Sroot #define DIALUP	"ttyd"			/* prefix for dialups */
1111421Sroot 
1121421Sroot struct	fstab	*fstabsearch();	/* search in fs_file and fs_spec */
1131421Sroot 
1141421Sroot /*
11537266Sbostic  *	The contents of the file _PATH_DUMPDATES is maintained both on
1161421Sroot  *	a linked list, and then (eventually) arrayified.
1171421Sroot  */
11846790Smckusick struct dumpdates {
11946790Smckusick 	char	dd_name[MAXNAMLEN+3];
12046790Smckusick 	char	dd_level;
12146790Smckusick 	time_t	dd_ddate;
1228375Smckusick };
12346790Smckusick struct dumptime {
12446790Smckusick 	struct	dumpdates dt_value;
12546790Smckusick 	struct	dumptime *dt_next;
1261421Sroot };
12746790Smckusick struct	dumptime *dthead;	/* head of the list version */
12846790Smckusick int	nddates;		/* number of records (might be zero) */
12946790Smckusick int	ddates_in;		/* we have read the increment file */
13046790Smckusick struct	dumpdates **ddatev;	/* the arrayfied version */
13146790Smckusick void	initdumptimes();
13246790Smckusick void	getdumptime();
13346790Smckusick void	putdumptime();
13446790Smckusick #define	ITITERATE(i, ddp) \
13546790Smckusick 	for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
1361421Sroot 
1371421Sroot /*
1381421Sroot  *	We catch these interrupts
1391421Sroot  */
14046589Storek void	sighup();
14146589Storek void	sigquit();
14246589Storek void	sigill();
14346589Storek void	sigtrap();
14446589Storek void	sigfpe();
14546589Storek void	sigkill();
14646589Storek void	sigbus();
14746589Storek void	sigsegv();
14846589Storek void	sigsys();
14946589Storek void	sigalrm();
15046589Storek void	sigterm();
15146807Smckusick 
15246807Smckusick /*
15346807Smckusick  * Compatibility with old systems.
15446807Smckusick  */
15546807Smckusick #ifndef __STDC__
15646807Smckusick #include <sys/file.h>
15746807Smckusick #define _PATH_FSTAB	"/etc/fstab"
158*49932Smckusick extern char *index(), *strdup();
15946807Smckusick extern char *ctime();
16046807Smckusick extern int errno;
16146807Smckusick #endif
162