122043Sdist /* 222043Sdist * Copyright (c) 1980 Regents of the University of California. 322043Sdist * All rights reserved. The Berkeley software License Agreement 422043Sdist * specifies the terms and conditions for redistribution. 522043Sdist * 6*39129Smckusick * @(#)dump.h 5.7 (Berkeley) 09/12/89 722043Sdist */ 813592Ssam 95328Smckusic #define NI 16 105328Smckusic #define MAXINOPB (MAXBSIZE / sizeof(struct dinode)) 115328Smckusic #define MAXNINDIR (MAXBSIZE / sizeof(daddr_t)) 121421Sroot 136642Ssam #include <sys/param.h> 146642Ssam #include <sys/stat.h> 15*39129Smckusick #include <sys/time.h> 16*39129Smckusick #include <ufs/fs.h> 17*39129Smckusick #include <sys/vnode.h> 18*39129Smckusick #include <ufs/inode.h> 1923543Smckusick #include <protocols/dumprestore.h> 2013544Ssam #include <sys/dir.h> 211421Sroot #include <utmp.h> 2237946Sbostic #include <sys/signal.h> 231421Sroot #include <fstab.h> 2437946Sbostic #include <stdio.h> 2537946Sbostic #include <ctype.h> 261421Sroot 275328Smckusic #define MWORD(m,i) (m[(unsigned)(i-1)/NBBY]) 285328Smckusic #define MBIT(i) (1<<((unsigned)(i-1)%NBBY)) 291421Sroot #define BIS(i,w) (MWORD(w,i) |= MBIT(i)) 301421Sroot #define BIC(i,w) (MWORD(w,i) &= ~MBIT(i)) 311421Sroot #define BIT(i,w) (MWORD(w,i) & MBIT(i)) 321421Sroot 335328Smckusic int msiz; 345328Smckusic char *clrmap; 355328Smckusic char *dirmap; 365328Smckusic char *nodmap; 371421Sroot 381421Sroot /* 391421Sroot * All calculations done in 0.1" units! 401421Sroot */ 411421Sroot 421421Sroot char *disk; /* name of the disk file */ 431421Sroot char *tape; /* name of the tape file */ 441421Sroot char *increm; /* name of the file containing incremental information*/ 4513150Ssam char *temp; /* name of the file for doing rewrite of increm */ 4613150Ssam char lastincno; /* increment number of previous dump */ 471421Sroot char incno; /* increment number */ 481421Sroot int uflag; /* update flag */ 491421Sroot int fi; /* disk file descriptor */ 501421Sroot int to; /* tape file descriptor */ 5112331Smckusick int pipeout; /* true => output to standard output */ 521421Sroot ino_t ino; /* current inumber; used globally */ 531421Sroot int nsubdir; 541421Sroot int newtape; /* new tape flag */ 551421Sroot int nadded; /* number of added sub directories */ 561421Sroot int dadded; /* directory added flag */ 571421Sroot int density; /* density in 0.1" units */ 581421Sroot long tsize; /* tape size in 0.1" units */ 591421Sroot long esize; /* estimated tape size, blocks */ 601421Sroot long asize; /* number of 0.1" units written on current tape */ 611421Sroot int etapes; /* estimated number of tapes */ 621421Sroot 631421Sroot int notify; /* notify operator flag */ 641421Sroot int blockswritten; /* number of blocks written on current tape */ 651421Sroot int tapeno; /* current tape number */ 661421Sroot time_t tstart_writing; /* when started writing the first tape block */ 671421Sroot char *processname; 685328Smckusic struct fs *sblock; /* the file system super block */ 695328Smckusic char buf[MAXBSIZE]; 7030559Smckusick long dev_bsize; 711421Sroot 721421Sroot char *ctime(); 731421Sroot char *prdate(); 741421Sroot long atol(); 751421Sroot int mark(); 761421Sroot int add(); 7717234Smckusick int dirdump(); 781421Sroot int dump(); 791421Sroot int tapsrec(); 801421Sroot int dmpspc(); 811421Sroot int dsrch(); 821421Sroot int nullf(); 831421Sroot char *getsuffix(); 841421Sroot char *rawname(); 854701Smckusic struct dinode *getino(); 861421Sroot 871421Sroot int interrupt(); /* in case operator bangs on console */ 881421Sroot 891421Sroot #define HOUR (60L*60L) 901421Sroot #define DAY (24L*HOUR) 911421Sroot #define YEAR (365L*DAY) 921421Sroot 931421Sroot /* 941421Sroot * Exit status codes 951421Sroot */ 9628641Smckusick #define X_FINOK 0 /* normal exit */ 971421Sroot #define X_REWRITE 2 /* restart writing from the check point */ 981421Sroot #define X_ABORT 3 /* abort all of dump; don't attempt checkpointing*/ 991421Sroot 1001421Sroot #define OPGRENT "operator" /* group entry to notify */ 1011421Sroot #define DIALUP "ttyd" /* prefix for dialups */ 1021421Sroot 1031421Sroot struct fstab *fstabsearch(); /* search in fs_file and fs_spec */ 1041421Sroot 1051421Sroot /* 10637266Sbostic * The contents of the file _PATH_DUMPDATES is maintained both on 1071421Sroot * a linked list, and then (eventually) arrayified. 1081421Sroot */ 1098375Smckusick struct idates { 1108375Smckusick char id_name[MAXNAMLEN+3]; 1118375Smckusick char id_incno; 1128375Smckusick time_t id_ddate; 1138375Smckusick }; 1141421Sroot struct itime{ 1151421Sroot struct idates it_value; 1161421Sroot struct itime *it_next; 1171421Sroot }; 1181421Sroot struct itime *ithead; /* head of the list version */ 1191421Sroot int nidates; /* number of records (might be zero) */ 1201421Sroot int idates_in; /* we have read the increment file */ 1211421Sroot struct idates **idatev; /* the arrayfied version */ 1221421Sroot #define ITITERATE(i, ip) for (i = 0,ip = idatev[0]; i < nidates; i++, ip = idatev[i]) 1231421Sroot 1241421Sroot /* 1251421Sroot * We catch these interrupts 1261421Sroot */ 1271421Sroot int sighup(); 1281421Sroot int sigquit(); 1291421Sroot int sigill(); 1301421Sroot int sigtrap(); 1311421Sroot int sigfpe(); 1321421Sroot int sigkill(); 1331421Sroot int sigbus(); 1341421Sroot int sigsegv(); 1351421Sroot int sigsys(); 1361421Sroot int sigalrm(); 1371421Sroot int sigterm(); 138