#pragma once #include "config.h" // IWYU pragma: keep #include "common/shared_globals.h" // IWYU pragma: keep #include #include #include #include "compat/include/protocols/dumprestore.h" #define XATTR_MAXSIZE 4096 // 60 is the combined size of the direct and indirect block pointers in the inode. #define INLINE_DATA_MAX_INODE_SIZE 60 /* * The entry describes the next file available on the tape */ struct context { const char *name; /* name of file */ dump_ino_t ino; /* inumber of file */ struct new_bsd_inode *dip; /* pointer to inode */ char action; /* action being taken on this file */ }; #define USING 1 /* extracting from the tape */ #define SKIP 2 /* skipping */ #define UNKNOWN 3 /* disposition or starting point is unknown */ /* * Flags */ extern char *Afile; /* archive file */ extern int aflag; /* automatic volume increment */ extern int bflag; /* set input block size */ extern int cvtflag; /* convert from old to new tape format */ extern int hflag; /* restore heirarchies */ extern int Lflag; /* compare errors limit */ extern int mflag; /* restore by name instead of inode number */ extern int Nflag; /* do not write the disk */ extern int oflag; /* do restore permissions without asking */ extern int uflag; /* unlink symlink targets */ extern int Vflag; /* multi-volume on a single device like CDROM */ extern int yflag; /* always try to recover from tape errors */ extern int nullflag; /* \0 separated output in t mode */ extern int ufs2flag; /* tape is a FreeBSD UFS2 dump */ extern char* bot_script; /* beginning of tape script */ /* * Global variables */ extern dump_ino_t maxino; /* highest numbered inode in this file system */ extern long dumpnum; /* location of the dump on this tape */ extern long volno; /* current volume being read */ extern time_t dumptime; /* time that this dump begins */ extern time_t dumpdate; /* time that this dump was made */ extern char command; /* opration being performed */ extern FILE *terminal; /* file descriptor for the terminal input */ extern const char *tmpdir; /* name of temp directory */ extern int oldinofmt; /* reading tape with old format inodes */ extern int Bcvt; /* need byte swapping on inodes and dirs */ extern int compare_ignore_not_found; /* used to compare incremental dumps, */ /* so messages about "not found" files */ /* isn't seen. */ extern int compare_errors; /* did we encounter any compare errors? */ extern char filesys[PATH_MAX];/* name of dumped filesystem */ extern int wdfd; /* original working directory */ extern int dirhash_size; /* size of the directory hash table */ #ifdef USE_QFA extern FILE *gTapeposfp; extern char gTps[255]; extern long gSeekstart; extern int tapeposflag; extern int gTapeposfd; extern int createtapeposflag; extern unsigned long qfadumpdate; extern off_t curtapepos; #endif #ifdef TRANSSELINUX /*GAN6May06 SELinux MLS */ extern int transselinuxflag; extern char *transselinuxarg; #endif extern char inline_data[INLINE_DATA_MAX_INODE_SIZE + XATTR_MAXSIZE]; extern int pipein; /* input is from a pipe */ extern struct context curfile; /* * Flags to setdirmodes. */ #define FORCE 0x0001 #define FORCENO 0x0002 #define do_compare_error \ if (++compare_errors >= Lflag && Lflag) { \ printf("Compare errors limit reached, exiting...\n"); \ exit(2); \ }