Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Apr 2020 00:18:20 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r359946 - in stable/12: include/protocols sbin/dump sbin/restore
Message-ID:  <202004150018.03F0IK6n039989@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mckusick
Date: Wed Apr 15 00:18:19 2020
New Revision: 359946
URL: https://svnweb.freebsd.org/changeset/base/359946

Log:
  MFC of 359627
  
  Update dump and restore to compile with -fno-common.

Modified:
  stable/12/include/protocols/dumprestore.h
  stable/12/sbin/dump/dump.h
  stable/12/sbin/dump/dumprmt.c
  stable/12/sbin/dump/itime.c
  stable/12/sbin/dump/main.c
  stable/12/sbin/dump/pathnames.h
  stable/12/sbin/dump/tape.c
  stable/12/sbin/restore/restore.h
  stable/12/sbin/restore/tape.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/include/protocols/dumprestore.h
==============================================================================
--- stable/12/include/protocols/dumprestore.h	Wed Apr 15 00:14:50 2020	(r359945)
+++ stable/12/include/protocols/dumprestore.h	Wed Apr 15 00:18:19 2020	(r359946)
@@ -76,7 +76,7 @@
  */
 typedef uint32_t dump_ino_t;
 
-union u_spcl {
+extern union u_spcl {
 	char dummy[TP_BSIZE];
 	struct	s_spcl {
 		int32_t	c_type;		    /* record type (see below) */

Modified: stable/12/sbin/dump/dump.h
==============================================================================
--- stable/12/sbin/dump/dump.h	Wed Apr 15 00:14:50 2020	(r359945)
+++ stable/12/sbin/dump/dump.h	Wed Apr 15 00:18:19 2020	(r359946)
@@ -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,40 +56,40 @@ 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 */
+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) */
 
-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) */
-
 /* operator interface functions */
 void	broadcast(const char *message);
 void	infosch(int);
@@ -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);

Modified: stable/12/sbin/dump/dumprmt.c
==============================================================================
--- stable/12/sbin/dump/dumprmt.c	Wed Apr 15 00:14:50 2020	(r359945)
+++ stable/12/sbin/dump/dumprmt.c	Wed Apr 15 00:18:19 2020	(r359946)
@@ -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)

Modified: stable/12/sbin/dump/itime.c
==============================================================================
--- stable/12/sbin/dump/itime.c	Wed Apr 15 00:14:50 2020	(r359945)
+++ stable/12/sbin/dump/itime.c	Wed Apr 15 00:18:19 2020	(r359946)
@@ -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 *);

Modified: stable/12/sbin/dump/main.c
==============================================================================
--- stable/12/sbin/dump/main.c	Wed Apr 15 00:14:50 2020	(r359945)
+++ stable/12/sbin/dump/main.c	Wed Apr 15 00:18:19 2020	(r359946)
@@ -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;

Modified: stable/12/sbin/dump/pathnames.h
==============================================================================
--- stable/12/sbin/dump/pathnames.h	Wed Apr 15 00:14:50 2020	(r359945)
+++ stable/12/sbin/dump/pathnames.h	Wed Apr 15 00:18:19 2020	(r359946)
@@ -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 */

Modified: stable/12/sbin/dump/tape.c
==============================================================================
--- stable/12/sbin/dump/tape.c	Wed Apr 15 00:14:50 2020	(r359945)
+++ stable/12/sbin/dump/tape.c	Wed Apr 15 00:18:19 2020	(r359946)
@@ -61,17 +61,19 @@ 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);
 static	void enslave(void);
@@ -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? */

Modified: stable/12/sbin/restore/restore.h
==============================================================================
--- stable/12/sbin/restore/restore.h	Wed Apr 15 00:14:50 2020	(r359945)
+++ stable/12/sbin/restore/restore.h	Wed Apr 15 00:18:19 2020	(r359946)
@@ -103,7 +103,7 @@ struct entry {
 /*
  * 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 */

Modified: stable/12/sbin/restore/tape.c
==============================================================================
--- stable/12/sbin/restore/tape.c	Wed Apr 15 00:14:50 2020	(r359945)
+++ stable/12/sbin/restore/tape.c	Wed Apr 15 00:18:19 2020	(r359946)
@@ -94,6 +94,8 @@ static char	*map;
 static char	lnkbuf[MAXPATHLEN + 1];
 static int	pathlen;
 
+struct context	curfile;	/* describes next file available on the tape */
+union u_spcl	u_spcl;		/* mapping of variables in a control block */
 int		Bcvt;		/* Swap Bytes */
 int		oldinofmt;	/* FreeBSD 1 inode format needs cvt */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004150018.03F0IK6n039989>