1*22043Sdist /* 2*22043Sdist * Copyright (c) 1980 Regents of the University of California. 3*22043Sdist * All rights reserved. The Berkeley software License Agreement 4*22043Sdist * specifies the terms and conditions for redistribution. 5*22043Sdist * 6*22043Sdist * @(#)dump.h 5.1 (Berkeley) 06/05/85 7*22043Sdist */ 813592Ssam 95328Smckusic #define NI 16 105328Smckusic #define MAXINOPB (MAXBSIZE / sizeof(struct dinode)) 115328Smckusic #define MAXNINDIR (MAXBSIZE / sizeof(daddr_t)) 121421Sroot 131421Sroot #include <stdio.h> 141421Sroot #include <ctype.h> 156642Ssam #include <sys/param.h> 166642Ssam #include <sys/stat.h> 176642Ssam #include <sys/fs.h> 186642Ssam #include <sys/inode.h> 196642Ssam #include <dumprestor.h> 2013544Ssam #include <sys/dir.h> 211421Sroot #include <utmp.h> 2213592Ssam #include <sys/time.h> 231421Sroot #include <signal.h> 241421Sroot #include <fstab.h> 251421Sroot 265328Smckusic #define MWORD(m,i) (m[(unsigned)(i-1)/NBBY]) 275328Smckusic #define MBIT(i) (1<<((unsigned)(i-1)%NBBY)) 281421Sroot #define BIS(i,w) (MWORD(w,i) |= MBIT(i)) 291421Sroot #define BIC(i,w) (MWORD(w,i) &= ~MBIT(i)) 301421Sroot #define BIT(i,w) (MWORD(w,i) & MBIT(i)) 311421Sroot 325328Smckusic int msiz; 335328Smckusic char *clrmap; 345328Smckusic char *dirmap; 355328Smckusic char *nodmap; 361421Sroot 371421Sroot /* 381421Sroot * All calculations done in 0.1" units! 391421Sroot */ 401421Sroot 411421Sroot char *disk; /* name of the disk file */ 421421Sroot char *tape; /* name of the tape file */ 431421Sroot char *increm; /* name of the file containing incremental information*/ 4413150Ssam char *temp; /* name of the file for doing rewrite of increm */ 4513150Ssam char lastincno; /* increment number of previous dump */ 461421Sroot char incno; /* increment number */ 471421Sroot int uflag; /* update flag */ 481421Sroot int fi; /* disk file descriptor */ 491421Sroot int to; /* tape file descriptor */ 5012331Smckusick int pipeout; /* true => output to standard output */ 511421Sroot ino_t ino; /* current inumber; used globally */ 521421Sroot int nsubdir; 531421Sroot int newtape; /* new tape flag */ 541421Sroot int nadded; /* number of added sub directories */ 551421Sroot int dadded; /* directory added flag */ 561421Sroot int density; /* density in 0.1" units */ 571421Sroot long tsize; /* tape size in 0.1" units */ 581421Sroot long esize; /* estimated tape size, blocks */ 591421Sroot long asize; /* number of 0.1" units written on current tape */ 601421Sroot int etapes; /* estimated number of tapes */ 611421Sroot 621421Sroot int notify; /* notify operator flag */ 631421Sroot int blockswritten; /* number of blocks written on current tape */ 641421Sroot int tapeno; /* current tape number */ 651421Sroot time_t tstart_writing; /* when started writing the first tape block */ 661421Sroot char *processname; 675328Smckusic struct fs *sblock; /* the file system super block */ 685328Smckusic char buf[MAXBSIZE]; 691421Sroot 701421Sroot char *ctime(); 711421Sroot char *prdate(); 721421Sroot long atol(); 731421Sroot int mark(); 741421Sroot int add(); 7517234Smckusick int dirdump(); 761421Sroot int dump(); 771421Sroot int tapsrec(); 781421Sroot int dmpspc(); 791421Sroot int dsrch(); 801421Sroot int nullf(); 811421Sroot char *getsuffix(); 821421Sroot char *rawname(); 834701Smckusic struct dinode *getino(); 841421Sroot 851421Sroot int interrupt(); /* in case operator bangs on console */ 861421Sroot 871421Sroot #define HOUR (60L*60L) 881421Sroot #define DAY (24L*HOUR) 891421Sroot #define YEAR (365L*DAY) 901421Sroot 911421Sroot /* 921421Sroot * Exit status codes 931421Sroot */ 941421Sroot #define X_FINOK 1 /* normal exit */ 951421Sroot #define X_REWRITE 2 /* restart writing from the check point */ 961421Sroot #define X_ABORT 3 /* abort all of dump; don't attempt checkpointing*/ 971421Sroot 981421Sroot #define NINCREM "/etc/dumpdates" /*new format incremental info*/ 9913150Ssam #define TEMP "/etc/dtmp" /*output temp file*/ 1001421Sroot 1011421Sroot #define TAPE "/dev/rmt8" /* default tape device */ 1021421Sroot #define DISK "/dev/rrp1g" /* default disk */ 1031421Sroot #define OPGRENT "operator" /* group entry to notify */ 1041421Sroot #define DIALUP "ttyd" /* prefix for dialups */ 1051421Sroot 1061421Sroot struct fstab *fstabsearch(); /* search in fs_file and fs_spec */ 1071421Sroot 1081421Sroot /* 1091421Sroot * The contents of the file NINCREM is maintained both on 1101421Sroot * a linked list, and then (eventually) arrayified. 1111421Sroot */ 1128375Smckusick struct idates { 1138375Smckusick char id_name[MAXNAMLEN+3]; 1148375Smckusick char id_incno; 1158375Smckusick time_t id_ddate; 1168375Smckusick }; 1171421Sroot struct itime{ 1181421Sroot struct idates it_value; 1191421Sroot struct itime *it_next; 1201421Sroot }; 1211421Sroot struct itime *ithead; /* head of the list version */ 1221421Sroot int nidates; /* number of records (might be zero) */ 1231421Sroot int idates_in; /* we have read the increment file */ 1241421Sroot struct idates **idatev; /* the arrayfied version */ 1251421Sroot #define ITITERATE(i, ip) for (i = 0,ip = idatev[0]; i < nidates; i++, ip = idatev[i]) 1261421Sroot 1271421Sroot /* 1281421Sroot * We catch these interrupts 1291421Sroot */ 1301421Sroot int sighup(); 1311421Sroot int sigquit(); 1321421Sroot int sigill(); 1331421Sroot int sigtrap(); 1341421Sroot int sigfpe(); 1351421Sroot int sigkill(); 1361421Sroot int sigbus(); 1371421Sroot int sigsegv(); 1381421Sroot int sigsys(); 1391421Sroot int sigalrm(); 1401421Sroot int sigterm(); 141