Largely following the commit by mckusick in FreeBSD.
ok naddy@
-/* $OpenBSD: dumprestore.h,v 1.10 2014/07/11 16:01:40 halex Exp $ */
+/* $OpenBSD: dumprestore.h,v 1.11 2021/01/21 00:16:36 mortimer Exp $ */
/* $NetBSD: dumprestore.h,v 1.14 2005/12/26 19:01:47 perry Exp $ */
/*
#endif
#define CHECKSUM (int)84446
-union u_spcl {
+extern union u_spcl {
char dummy[TP_BSIZE];
struct s_spcl {
int32_t c_type; /* record type (see below) */
-/* $OpenBSD: dump.h,v 1.24 2015/05/23 05:17:20 guenther Exp $ */
+/* $OpenBSD: dump.h,v 1.25 2021/01/21 00:16:36 mortimer Exp $ */
/* $NetBSD: dump.h,v 1.11 1997/06/05 11:13:20 lukem Exp $ */
/*-
/*
* Dump maps used to describe what is to be dumped.
*/
-int mapsize; /* size of the state maps */
-char *usedinomap; /* map of allocated inodes */
-char *dumpdirmap; /* map of directories to be dumped */
-char *dumpinomap; /* map of files to be dumped */
+extern int mapsize; /* size of the state maps */
+extern char *usedinomap; /* map of allocated inodes */
+extern char *dumpdirmap; /* map of directories to be dumped */
+extern char *dumpinomap; /* map of files to be dumped */
/*
* Map manipulation macros.
*/
/*
* All calculations done in 0.1" units!
*/
-char *disk; /* name of the disk file */
-char *tape; /* name of the tape file */
-char *dumpdates; /* name of the file containing dump date information*/
-char *temp; /* name of the file for doing rewrite of dumpdates */
-char *duid; /* duid of the disk being dumped */
-char lastlevel; /* dump level of previous dump */
-char level; /* dump level of this dump */
-int uflag; /* update flag */
-int diskfd; /* disk file descriptor */
-int tapefd; /* tape file descriptor */
-int pipeout; /* true => output to standard output */
-ino_t curino; /* current inumber; used globally */
-int newtape; /* new tape flag */
-int density; /* density in 0.1" units */
-int64_t tapesize; /* estimated tape size, blocks */
-int64_t tsize; /* tape size in 0.1" units */
-int unlimited; /* if set, write to end of medium */
-int64_t asize; /* number of 0.1" units written on current tape */
-int etapes; /* estimated number of tapes */
-int nonodump; /* if set, do not honor UF_NODUMP user flags */
-
-int notify; /* notify operator flag */
-int64_t blockswritten; /* number of blocks written on current tape */
-int tapeno; /* current tape number */
-time_t tstart_writing; /* when started writing the first tape block */
-long xferrate; /* averaged transfer rate of all volumes */
-struct fs *sblock; /* the file system super block */
-char sblock_buf[MAXBSIZE];
-int tp_bshift; /* log2(TP_BSIZE) */
+extern char *disk; /* name of the disk file */
+extern char *tape; /* name of the tape file */
+extern char *dumpdates; /* name of the file containing dump date information*/
+extern char *duid; /* duid of the disk being dumped */
+extern char lastlevel; /* dump level of previous dump */
+extern char level; /* dump level of this dump */
+extern int uflag; /* update flag */
+extern int diskfd; /* disk file descriptor */
+extern int pipeout; /* true => output to standard output */
+extern ino_t curino; /* current inumber; used globally */
+extern int newtape; /* new tape flag */
+extern int density; /* density in 0.1" units */
+extern int64_t tapesize; /* estimated tape size, blocks */
+extern int64_t tsize; /* tape size in 0.1" units */
+extern int unlimited; /* if set, write to end of medium */
+extern int etapes; /* estimated number of tapes */
+extern int nonodump; /* if set, do not honor UF_NODUMP user flags */
+extern int notify; /* notify operator flag */
+extern int64_t blockswritten; /* number of blocks written on current tape */
+extern int tapeno; /* current tape number */
+extern int ntrec; /* blocking factor on tape */
+extern int64_t blocksperfile; /* number of blocks per output file */
+extern int cartridge; /* assume non-cartridge tape */
+extern char *host; /* remote host (if any) */
+extern time_t tstart_writing; /* when started writing the first tape block */
+extern long xferrate; /* averaged transfer rate of all volumes */
+extern struct fs *sblock; /* the file system super block */
+extern char sblock_buf[MAXBSIZE];
+extern int tp_bshift; /* log2(TP_BSIZE) */
/* operator interface functions */
void broadcast(char *message);
struct dumpdates dt_value;
struct dumptime *dt_next;
};
-struct dumptime *dthead; /* head of the list version */
-int nddates; /* number of records (might be zero) */
-int ddates_in; /* we have read the increment file */
-struct dumpdates **ddatev; /* the arrayfied version */
+extern struct dumptime *dthead; /* head of the list version */
+extern int ddates_in; /* we have read the increment file */
+extern int nddates; /* number of records (might be zero) */
+extern struct dumpdates **ddatev; /* the arrayfied version */
void initdumptimes(void);
void getdumptime(void);
void putdumptime(void);
-/* $OpenBSD: dumprmt.c,v 1.30 2019/06/28 13:32:43 deraadt Exp $ */
+/* $OpenBSD: dumprmt.c,v 1.31 2021/01/21 00:16:36 mortimer Exp $ */
/* $NetBSD: dumprmt.c,v 1.17 1997/06/05 16:10:47 mrg Exp $ */
/*-
int rmtioctl(int cmd, int count);
void rmtclose(void);
-extern int ntrec; /* blocking factor on tape */
int
rmthost(char *host)
-/* $OpenBSD: itime.c,v 1.24 2019/06/28 13:32:43 deraadt Exp $ */
+/* $OpenBSD: itime.c,v 1.25 2021/01/21 00:16:36 mortimer Exp $ */
/* $NetBSD: itime.c,v 1.4 1997/04/15 01:09:50 lukem Exp $ */
/*-
#include "dump.h"
-struct dumpdates **ddatev = NULL;
int nddates = 0;
+struct dumpdates **ddatev = NULL;
+char *dumpdates = NULL;
+char lastlevel = 0;
int ddates_in = 0;
struct dumptime *dthead = NULL;
-/* $OpenBSD: main.c,v 1.61 2019/06/28 13:32:43 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.62 2021/01/21 00:16:36 mortimer Exp $ */
/* $NetBSD: main.c,v 1.14 1997/06/05 11:13:24 lukem Exp $ */
/*-
#include "dump.h"
#include "pathnames.h"
-int notify = 0; /* notify operator flag */
-int64_t blockswritten = 0; /* number of blocks written on current tape */
-int tapeno = 0; /* current tape number */
-int density = 0; /* density in bytes/0.1" */
-int ntrec = NTREC; /* # tape blocks in each tape record */
-int cartridge = 0; /* Assume non-cartridge tape */
-int64_t blocksperfile; /* output blocks per file */
-char *host = NULL; /* remote host (if any) */
-int maxbsize = 64*1024; /* XXX MAXBSIZE from sys/param.h */
+int mapsize; /* size of the state maps */
+char *usedinomap; /* map of allocated inodes */
+char *dumpdirmap; /* map of directories to be dumped */
+char *dumpinomap; /* map of files to be dumped */
+char *disk; /* name of the disk file */
+char *tape; /* name of the tape file */
+char level; /* dump level of this dump */
+int uflag; /* update flag */
+int diskfd; /* disk file descriptor */
+int pipeout; /* true => output to standard output */
+int density = 0; /* density in bytes/0.1" */
+int64_t tapesize; /* estimated tape size, blocks */
+int64_t tsize; /* tape size in 0.1" units */
+int etapes; /* estimated number of tapes */
+int nonodump; /* if set, do not honor UF_NODUMP user flags */
+int unlimited; /* if set, write to end of medium */
+int notify = 0; /* notify operator flag */
+int64_t blockswritten = 0; /* number of blocks written on current tape */
+int tapeno = 0; /* current tape number */
+int ntrec = NTREC; /* # tape blocks in each tape record */
+int64_t blocksperfile; /* output blocks per file */
+int cartridge = 0; /* Assume non-cartridge tape */
+char *host = NULL; /* remote host (if any) */
+time_t tstart_writing; /* when started writing the first tape block */
+long xferrate; /* averaged transfer rate of all volumes */
+struct fs *sblock; /* the file system super block */
+char sblock_buf[MAXBSIZE];
+int tp_bshift; /* log2(TP_BSIZE) */
+char *duid; /* duid of the disk being dumped */
+int maxbsize = 64*1024; /* XXX MAXBSIZE from sys/param.h */
struct disklabel lab;
if ((tape = getenv("TAPE")) == NULL)
tape = _PATH_DEFTAPE;
dumpdates = _PATH_DUMPDATES;
- temp = _PATH_DTMP;
if (TP_BSIZE / DEV_BSIZE == 0 || TP_BSIZE % DEV_BSIZE != 0)
quit("TP_BSIZE must be a multiple of DEV_BSIZE\n");
level = '0';
-/* $OpenBSD: pathnames.h,v 1.6 2003/06/02 20:06:14 millert Exp $ */
+/* $OpenBSD: pathnames.h,v 1.7 2021/01/21 00:16:36 mortimer Exp $ */
/* $NetBSD: pathnames.h,v 1.9 1997/04/15 07:00:47 lukem Exp $ */
/*
#include <paths.h>
-#define _PATH_DTMP "/etc/dtmp"
#define _PATH_DUMPDATES "/etc/dumpdates"
#define _PATH_LOCK "/tmp/dumplockXXXXXX"
#define _PATH_RMT "/etc/rmt"
-/* $OpenBSD: tape.c,v 1.46 2020/10/01 07:58:54 otto Exp $ */
+/* $OpenBSD: tape.c,v 1.47 2021/01/21 00:16:36 mortimer Exp $ */
/* $NetBSD: tape.c,v 1.11 1997/06/05 11:13:26 lukem Exp $ */
/*-
#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
-int writesize; /* size of malloc()ed buffer for tape */
-int64_t lastspclrec = -1; /* tape block number of last written header */
-int trecno = 0; /* next record to write in current block */
-extern int64_t blocksperfile; /* number of blocks per output file */
-int64_t blocksthisvol; /* number of blocks on current output file */
-extern int ntrec; /* blocking factor on tape */
-extern int cartridge;
-extern char *host;
-char *nexttape;
+ino_t curino; /* current inumber; used globally */
+int newtape; /* new tape flag */
+union u_spcl u_spcl; /* mapping of variables in a control block */
+
+static int tapefd; /* tape file descriptor */
+static int64_t asize; /* number of 0.1" units written on cur tape */
+static int writesize; /* size of malloc()ed buffer for tape */
+static int64_t lastspclrec = -1; /* tape block number of last written header */
+static int trecno = 0; /* next record to write in current block */
+static int64_t blocksthisvol; /* number of blocks on current output file */
+static char *nexttape;
static ssize_t atomic(ssize_t (*)(int, void *, size_t), int, char *, int);
static void doslave(int, int);
daddr_t dblk;
int count;
};
-int reqsiz;
+static int reqsiz;
#define SLAVES 3 /* 1 slave writing, 1 reading, 1 for slack */
-struct slave {
+static struct slave {
int64_t tapea; /* header number at start of this chunk */
int64_t firstrec; /* record number of this block */
int count; /* count to next header (used for TS_TAPE */
char (*tblock)[TP_BSIZE]; /* buffer for data blocks */
struct req *req; /* buffer for requests */
} slaves[SLAVES+1];
-struct slave *slp;
+static struct slave *slp;
-char (*nextblock)[TP_BSIZE];
+static char (*nextblock)[TP_BSIZE];
static time_t tstart_volume; /* time of volume start */
static int64_t tapea_volume; /* value of spcl.c_tapea at volume start */
-pid_t master; /* pid of master, for sending error signals */
-int tenths; /* length of tape used per block written */
+static pid_t master; /* pid of master, for sending error signals */
+static int tenths; /* length of tape used per block written */
static volatile sig_atomic_t caught; /* have we caught the signal to proceed? */
int
-/* $OpenBSD: restore.h,v 1.9 2017/01/21 08:31:44 krw Exp $ */
+/* $OpenBSD: restore.h,v 1.10 2021/01/21 00:16:36 mortimer Exp $ */
/* $NetBSD: restore.h,v 1.8 1997/07/01 05:37:54 lukem Exp $ */
/*
/*
* The entry describes the next file available on the tape
*/
-struct context {
+extern struct context {
short action; /* action being taken on this file */
mode_t mode; /* mode of file */
ino_t ino; /* inumber of file */
-/* $OpenBSD: tape.c,v 1.51 2019/06/28 13:32:46 deraadt Exp $ */
+/* $OpenBSD: tape.c,v 1.52 2021/01/21 00:16:36 mortimer Exp $ */
/* $NetBSD: tape.c,v 1.26 1997/04/15 07:12:25 lukem Exp $ */
/*
static char lnkbuf[PATH_MAX + 1];
static size_t pathlen;
+struct context curfile; /* describes next file available on the tape */
+union u_spcl u_spcl; /* mapping of variables in a control block */
int oldinofmt; /* old inode format conversion required */
int Bcvt; /* Swap Bytes (for CCI or sun) */