xref: /csrg-svn/sbin/dump/dump.h (revision 6642)
11421Sroot /*
2*6642Ssam  * "@(#)dump.h	1.6 (Berkeley) 05/07/82"
31421Sroot  */
45328Smckusic #define	NI		16
55328Smckusic #define MAXINOPB	(MAXBSIZE / sizeof(struct dinode))
65328Smckusic #define MAXNINDIR	(MAXBSIZE / sizeof(daddr_t))
71421Sroot 
81421Sroot #include <stdio.h>
91421Sroot #include <ctype.h>
10*6642Ssam #include <sys/param.h>
11*6642Ssam #include <sys/stat.h>
12*6642Ssam #include <sys/fs.h>
13*6642Ssam #include <sys/inode.h>
14*6642Ssam #include <dumprestor.h>
151421Sroot #include <utmp.h>
161421Sroot #include <time.h>
171421Sroot #include <signal.h>
184701Smckusic int (*signal())();
191421Sroot #include <fstab.h>
201421Sroot 
215328Smckusic #define	MWORD(m,i)	(m[(unsigned)(i-1)/NBBY])
225328Smckusic #define	MBIT(i)		(1<<((unsigned)(i-1)%NBBY))
231421Sroot #define	BIS(i,w)	(MWORD(w,i) |=  MBIT(i))
241421Sroot #define	BIC(i,w)	(MWORD(w,i) &= ~MBIT(i))
251421Sroot #define	BIT(i,w)	(MWORD(w,i) & MBIT(i))
261421Sroot 
275328Smckusic int	msiz;
285328Smckusic char	*clrmap;
295328Smckusic char	*dirmap;
305328Smckusic char	*nodmap;
311421Sroot 
321421Sroot /*
331421Sroot  *	All calculations done in 0.1" units!
341421Sroot  */
351421Sroot 
361421Sroot char	*disk;		/* name of the disk file */
371421Sroot char	*tape;		/* name of the tape file */
381421Sroot char	*increm;	/* name of the file containing incremental information*/
391421Sroot char	incno;		/* increment number */
401421Sroot int	uflag;		/* update flag */
411421Sroot int	fi;		/* disk file descriptor */
421421Sroot int	to;		/* tape file descriptor */
431421Sroot ino_t	ino;		/* current inumber; used globally */
441421Sroot int	nsubdir;
451421Sroot int	newtape;	/* new tape flag */
461421Sroot int	nadded;		/* number of added sub directories */
471421Sroot int	dadded;		/* directory added flag */
481421Sroot int	density;	/* density in 0.1" units */
491421Sroot long	tsize;		/* tape size in 0.1" units */
501421Sroot long	esize;		/* estimated tape size, blocks */
511421Sroot long	asize;		/* number of 0.1" units written on current tape */
521421Sroot int	etapes;		/* estimated number of tapes */
531421Sroot 
541421Sroot int	notify;		/* notify operator flag */
551421Sroot int	blockswritten;	/* number of blocks written on current tape */
561421Sroot int	tapeno;		/* current tape number */
571421Sroot time_t	tstart_writing;	/* when started writing the first tape block */
581421Sroot char	*processname;
595328Smckusic struct fs *sblock;	/* the file system super block */
605328Smckusic char	buf[MAXBSIZE];
611421Sroot 
621421Sroot char	*ctime();
631421Sroot char	*prdate();
641421Sroot long	atol();
651421Sroot int	mark();
661421Sroot int	add();
671421Sroot int	dump();
681421Sroot int	tapsrec();
691421Sroot int	dmpspc();
701421Sroot int	dsrch();
711421Sroot int	nullf();
721421Sroot char	*getsuffix();
731421Sroot char	*rawname();
744701Smckusic struct dinode *getino();
751421Sroot 
761421Sroot int	interrupt();		/* in case operator bangs on console */
771421Sroot 
781421Sroot #define	HOUR	(60L*60L)
791421Sroot #define	DAY	(24L*HOUR)
801421Sroot #define	YEAR	(365L*DAY)
811421Sroot 
821421Sroot /*
831421Sroot  *	Exit status codes
841421Sroot  */
851421Sroot #define	X_FINOK		1	/* normal exit */
861421Sroot #define	X_REWRITE	2	/* restart writing from the check point */
871421Sroot #define	X_ABORT		3	/* abort all of dump; don't attempt checkpointing*/
881421Sroot 
891421Sroot #ifdef DEBUG
901421Sroot #define	OINCREM	"./ddate"		/*old format incremental info*/
911421Sroot #define	NINCREM	"./dumpdates"		/*new format incremental info*/
921421Sroot #else not DEBUG
931421Sroot #define	OINCREM	"/etc/ddate"		/*old format incremental info*/
941421Sroot #define	NINCREM	"/etc/dumpdates"	/*new format incremental info*/
951421Sroot #endif
961421Sroot 
971421Sroot #define	TAPE	"/dev/rmt8"		/* default tape device */
981421Sroot #define	DISK	"/dev/rrp1g"		/* default disk */
991421Sroot #define	OPGRENT	"operator"		/* group entry to notify */
1001421Sroot #define DIALUP	"ttyd"			/* prefix for dialups */
1011421Sroot 
1021421Sroot #define	MAXFSTAB		32
1031421Sroot struct	fstab	fstab[MAXFSTAB];
1041421Sroot struct	fstab	*fstabsearch();	/* search in fs_file and fs_spec */
1051421Sroot int	nfstab;
1061421Sroot 
1071421Sroot /*
1081421Sroot  *	The contents of the file NINCREM is maintained both on
1091421Sroot  *	a linked list, and then (eventually) arrayified.
1101421Sroot  */
1111421Sroot struct	itime{
1121421Sroot 	struct	idates	it_value;
1131421Sroot 	struct	itime	*it_next;
1141421Sroot };
1151421Sroot struct	itime	*ithead;	/* head of the list version */
1161421Sroot int	nidates;		/* number of records (might be zero) */
1171421Sroot int	idates_in;		/* we have read the increment file */
1181421Sroot struct	idates	**idatev;	/* the arrayfied version */
1191421Sroot #define	ITITERATE(i, ip) for (i = 0,ip = idatev[0]; i < nidates; i++, ip = idatev[i])
1201421Sroot 
1211421Sroot /*
1221421Sroot  *	We catch these interrupts
1231421Sroot  */
1241421Sroot int	sighup();
1251421Sroot int	sigquit();
1261421Sroot int	sigill();
1271421Sroot int	sigtrap();
1281421Sroot int	sigfpe();
1291421Sroot int	sigkill();
1301421Sroot int	sigbus();
1311421Sroot int	sigsegv();
1321421Sroot int	sigsys();
1331421Sroot int	sigalrm();
1341421Sroot int	sigterm();
135