aboutsummaryrefslogtreecommitdiff
path: root/sbin/dump
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2020-04-04 00:56:56 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2020-04-04 00:56:56 +0000
commit33ceb489d33e71b81adbd12bded321ad4486e42a (patch)
tree37ed02fb50e871dce37fa5cf90bf5d37971161d6 /sbin/dump
parent2efe3be95ede0aa2e7eb4afecc40977af00d4b52 (diff)
Notes
Diffstat (limited to 'sbin/dump')
-rw-r--r--sbin/dump/dump.h78
-rw-r--r--sbin/dump/dumprmt.c1
-rw-r--r--sbin/dump/itime.c6
-rw-r--r--sbin/dump/main.c36
-rw-r--r--sbin/dump/pathnames.h1
-rw-r--r--sbin/dump/tape.c34
6 files changed, 90 insertions, 66 deletions
diff --git a/sbin/dump/dump.h b/sbin/dump/dump.h
index 680ff8a9b7a96..fc8c845fc5764 100644
--- a/sbin/dump/dump.h
+++ b/sbin/dump/dump.h
@@ -36,10 +36,10 @@
/*
* 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.
*/
@@ -56,39 +56,39 @@ char *dumpinomap; /* map of files to be dumped */
/*
* All calculations done in 0.1" units!
*/
-char *disk; /* name of the disk file */
-char *tape; /* name of the tape file */
-char *popenout; /* popen(3) per-"tape" command */
-char *dumpdates; /* name of the file containing dump date information*/
-char *temp; /* name of the file for doing rewrite of dumpdates */
-int lastlevel; /* dump level of previous dump */
-int 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 */
-long tapesize; /* estimated tape size, blocks */
-long tsize; /* tape size in 0.1" units */
-long 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 unlimited; /* if set, write to end of medium */
-int cachesize; /* size of block cache in bytes */
-int rsync_friendly; /* be friendly with rsync */
-
-int notify; /* notify operator flag */
-int blockswritten; /* number of blocks written on current tape */
-int tapeno; /* current tape number */
-time_t tstart_writing; /* when started writing the first tape block */
-time_t tend_writing; /* after writing the last tape block */
-int passno; /* current dump pass number */
-struct fs *sblock; /* the file system super block */
-long dev_bsize; /* block size of underlying disk device */
-int dev_bshift; /* log2(dev_bsize) */
-int tp_bshift; /* log2(TP_BSIZE) */
+extern char *disk; /* name of the disk file */
+extern char *tape; /* name of the tape file */
+extern char *popenout; /* popen(3) per-"tape" command */
+extern char *dumpdates; /* name of the file containing dump date info */
+extern int lastlevel; /* dump level of previous dump */
+extern int 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 long tapesize; /* estimated tape size, blocks */
+extern long tsize; /* tape size in 0.1" units */
+extern int etapes; /* estimated number of tapes */
+extern int nonodump; /* if set, do not honor UF_NODUMP user flags */
+extern int unlimited; /* if set, write to end of medium */
+extern int cachesize; /* size of block cache in bytes */
+extern int rsync_friendly; /* be friendly with rsync */
+extern int notify; /* notify operator flag */
+extern int blockswritten; /* number of blocks written on current tape */
+extern int tapeno; /* current tape number */
+extern int ntrec; /* blocking factor on tape */
+extern long 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 time_t tend_writing; /* after writing the last tape block */
+extern int passno; /* current dump pass number */
+extern struct fs *sblock; /* the file system super block */
+extern long dev_bsize; /* block size of underlying disk device */
+extern int dev_bshift; /* log2(dev_bsize) */
+extern int tp_bshift; /* log2(TP_BSIZE) */
/* operator interface functions */
void broadcast(const char *message);
@@ -163,8 +163,8 @@ struct dumpdates {
int dd_level;
time_t dd_ddate;
};
-int nddates; /* number of records (might be zero) */
-struct dumpdates **ddatev; /* the arrayfied version */
+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);
diff --git a/sbin/dump/dumprmt.c b/sbin/dump/dumprmt.c
index 66a80bbd9f0b6..d1769faa3daf8 100644
--- a/sbin/dump/dumprmt.c
+++ b/sbin/dump/dumprmt.c
@@ -80,7 +80,6 @@ static void rmtgets(char *, int);
static int rmtreply(const char *);
static int errfd = -1;
-extern int ntrec; /* blocking factor on tape */
int
rmthost(const char *host)
diff --git a/sbin/dump/itime.c b/sbin/dump/itime.c
index 93ae6a2180e49..cb6d55625e6df 100644
--- a/sbin/dump/itime.c
+++ b/sbin/dump/itime.c
@@ -60,8 +60,10 @@ struct dumptime {
SLIST_ENTRY(dumptime) dt_list;
};
SLIST_HEAD(dthead, dumptime) dthead = SLIST_HEAD_INITIALIZER(dthead);
-struct dumpdates **ddatev = NULL;
-int nddates = 0;
+int nddates = 0; /* number of records (might be zero) */
+struct dumpdates **ddatev; /* the arrayfied version */
+char *dumpdates; /* name of the file containing dump date info */
+int lastlevel; /* dump level of previous dump */
static void dumprecout(FILE *, const struct dumpdates *);
static int getrecord(FILE *, struct dumpdates *);
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index 135b4fcfb64ca..bbc54d7ab5d77 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -73,17 +73,40 @@ static const char rcsid[] =
#include "dump.h"
#include "pathnames.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 *popenout; /* popen(3) per-"tape" command */
+int 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" " <- this is for hilit19 */
+long tapesize; /* estimated tape size, blocks */
+long 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 cachesize = 0; /* block cache size (in bytes), defaults to 0 */
+int rsync_friendly; /* be friendly with rsync */
int notify = 0; /* notify operator flag */
-int snapdump = 0; /* dumping live filesystem, so use snapshot */
-int blockswritten = 0; /* number of blocks written on current tape */
+int blockswritten = 0; /* number of blocks written on current tape */
int tapeno = 0; /* current tape number */
-int density = 0; /* density in bytes/0.1" " <- this is for hilit19 */
int ntrec = NTREC; /* # tape blocks in each tape record */
+long blocksperfile; /* number of blocks per output file */
int cartridge = 0; /* Assume non-cartridge tape */
-int cachesize = 0; /* block cache size (in bytes), defaults to 0 */
-long dev_bsize = 1; /* recalculated below */
-long blocksperfile; /* output blocks per file */
char *host = NULL; /* remote host (if any) */
+time_t tstart_writing; /* when started writing the first tape block */
+time_t tend_writing; /* after writing the last tape block */
+int passno; /* current dump pass number */
+struct fs *sblock; /* the file system super block */
+long dev_bsize = 1; /* recalculated below */
+int dev_bshift; /* log2(dev_bsize) */
+int tp_bshift; /* log2(TP_BSIZE) */
+int snapdump = 0; /* dumping live filesystem, so use snapshot */
static char *getmntpt(char *, int *);
static long numarg(const char *, long, long);
@@ -111,7 +134,6 @@ main(int argc, char *argv[])
dumpdates = _PATH_DUMPDATES;
popenout = NULL;
tape = NULL;
- 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;
diff --git a/sbin/dump/pathnames.h b/sbin/dump/pathnames.h
index 6f56aeff7a516..120bd72f5f11d 100644
--- a/sbin/dump/pathnames.h
+++ b/sbin/dump/pathnames.h
@@ -35,7 +35,6 @@
#include <paths.h>
#define _PATH_DEFTAPE "/dev/sa0"
-#define _PATH_DTMP "/etc/dtmp"
#define _PATH_DUMPDATES "/etc/dumpdates"
#define _PATH_LOCK "/tmp/dumplockXXXXXX"
#define _PATH_RMT "/etc/rmt" /* path on remote host */
diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c
index ddb9612bb4c2a..ef0201df25704 100644
--- a/sbin/dump/tape.c
+++ b/sbin/dump/tape.c
@@ -61,16 +61,18 @@ static const char rcsid[] =
#include "dump.h"
-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 long blocksperfile; /* number of blocks per output file */
-long blocksthisvol; /* number of blocks on current output file */
-extern int ntrec; /* blocking factor on tape */
-extern int cartridge;
-extern char *host;
-char *nexttape;
-FILE *popenfp = NULL;
+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 long 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 long blocksthisvol; /* number of blocks on current output file */
+static char *nexttape;
+static FILE *popenfp = NULL;
static int atomic(ssize_t (*)(), int, char *, int);
static void doslave(int, int);
@@ -91,10 +93,10 @@ struct req {
ufs2_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 */
@@ -106,12 +108,12 @@ struct slave {
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];
-int master; /* pid of master, for sending error signals */
-int tenths; /* length of tape used per block written */
+static int 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? */
static volatile sig_atomic_t ready; /* reached the lock point without having */
/* received the SIGUSR2 signal from the prev slave? */