1*22035Sdist /* 2*22035Sdist * Copyright (c) 1980 Regents of the University of California. 3*22035Sdist * All rights reserved. The Berkeley software License Agreement 4*22035Sdist * specifies the terms and conditions for redistribution. 5*22035Sdist * 6*22035Sdist * @(#)dump.h 5.1 (Berkeley) 06/05/85 7*22035Sdist */ 814562Ssam 91421Sroot #define NI 16 101421Sroot #define DIRPB (BSIZE/sizeof(struct direct)) 111421Sroot 121421Sroot #include <stdio.h> 131421Sroot #include <ctype.h> 1413048Ssam #include <fstab.h> 1513048Ssam #include <signal.h> 1613048Ssam #include <utmp.h> 1712081Smckusick #include "include.4.1/sys/param.h" 1812081Smckusick #include "include.4.1/sys/stat.h" 1912081Smckusick #include "include.4.1/sys/filsys.h" 2012081Smckusick #include "include.4.1/sys/ino.h" 2112081Smckusick #include "include.4.1/sys/inode.h" 2212081Smckusick #include "include.4.1/sys/fblk.h" 2312081Smckusick #include "include.4.1/sys/dir.h" 2412081Smckusick #include "include.4.1/time.h" 2512081Smckusick #include "include.4.1/dumprestor.h" 261421Sroot 271421Sroot #define MWORD(m,i) (m[(unsigned)(i-1)/MLEN]) 281421Sroot #define MBIT(i) (1<<((unsigned)(i-1)%MLEN)) 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 331421Sroot short clrmap[MSIZ]; 341421Sroot short dirmap[MSIZ]; 351421Sroot short nodmap[MSIZ]; 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 */ 4312081Smckusick char pipeout; /* true => output to standard output */ 441421Sroot char *increm; /* name of the file containing incremental information*/ 451421Sroot char incno; /* increment number */ 461421Sroot int uflag; /* update flag */ 471421Sroot int fi; /* disk file descriptor */ 481421Sroot int to; /* tape file descriptor */ 491421Sroot ino_t ino; /* current inumber; used globally */ 501421Sroot int nsubdir; 511421Sroot int newtape; /* new tape flag */ 521421Sroot int nadded; /* number of added sub directories */ 531421Sroot int dadded; /* directory added flag */ 541421Sroot int density; /* density in 0.1" units */ 551421Sroot long tsize; /* tape size in 0.1" units */ 561421Sroot long esize; /* estimated tape size, blocks */ 571421Sroot long asize; /* number of 0.1" units written on current tape */ 581421Sroot int etapes; /* estimated number of tapes */ 591421Sroot 601421Sroot int notify; /* notify operator flag */ 611421Sroot int blockswritten; /* number of blocks written on current tape */ 621421Sroot int tapeno; /* current tape number */ 631421Sroot time_t tstart_writing; /* when started writing the first tape block */ 641421Sroot char *processname; 651421Sroot 661421Sroot char *ctime(); 671421Sroot char *prdate(); 681421Sroot long atol(); 691421Sroot int mark(); 701421Sroot int add(); 711421Sroot int dump(); 721421Sroot int tapsrec(); 731421Sroot int dmpspc(); 741421Sroot int dsrch(); 751421Sroot int nullf(); 761421Sroot char *getsuffix(); 771421Sroot char *rawname(); 781421Sroot 791421Sroot int interrupt(); /* in case operator bangs on console */ 801421Sroot 811421Sroot #define HOUR (60L*60L) 821421Sroot #define DAY (24L*HOUR) 831421Sroot #define YEAR (365L*DAY) 841421Sroot 851421Sroot /* 861421Sroot * Exit status codes 871421Sroot */ 881421Sroot #define X_FINOK 1 /* normal exit */ 891421Sroot #define X_REWRITE 2 /* restart writing from the check point */ 901421Sroot #define X_ABORT 3 /* abort all of dump; don't attempt checkpointing*/ 911421Sroot 921421Sroot #ifdef DEBUG 931421Sroot #define OINCREM "./ddate" /*old format incremental info*/ 941421Sroot #define NINCREM "./dumpdates" /*new format incremental info*/ 951421Sroot #else not DEBUG 961421Sroot #define OINCREM "/etc/ddate" /*old format incremental info*/ 971421Sroot #define NINCREM "/etc/dumpdates" /*new format incremental info*/ 981421Sroot #endif 991421Sroot 1001421Sroot #define TAPE "/dev/rmt8" /* default tape device */ 1011421Sroot #define DISK "/dev/rrp1g" /* default disk */ 1021421Sroot #define OPGRENT "operator" /* group entry to notify */ 1031421Sroot #define DIALUP "ttyd" /* prefix for dialups */ 1041421Sroot 1051421Sroot struct fstab *fstabsearch(); /* search in fs_file and fs_spec */ 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