* cleanup for WARNS=1

* fix use of .Nm
* comment out some unused(?) functions
This commit is contained in:
lukem 1997-09-15 07:58:01 +00:00
parent be24f789ad
commit a84bab531d
8 changed files with 99 additions and 61 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: dump.8,v 1.17 1997/06/05 11:15:06 lukem Exp $
.\" $NetBSD: dump.8,v 1.18 1997/09/15 07:58:01 lukem Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" Regents of the University of California.
@ -94,7 +94,7 @@ is ignored, the only dump level that is supported is
and all of the files must reside on the same filesystem.
.Pp
The following options are supported by
.Nm dump :
.Nm "" :
.Bl -tag -width Ds
.It Fl 0\-9
Dump levels.
@ -246,7 +246,7 @@ In addition to alerting all operators implied by the
flag,
.Nm
interacts with the operator on
.Nm dump Ns 's
.Nm "" Ns 's
control terminal at times when
.Nm
can no longer proceed,

View File

@ -1,4 +1,4 @@
/* $NetBSD: dumprmt.c,v 1.17 1997/06/05 16:10:47 mrg Exp $ */
/* $NetBSD: dumprmt.c,v 1.18 1997/09/15 07:58:03 lukem Exp $ */
/*-
* Copyright (c) 1980, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)dumprmt.c 8.1 (Berkeley) 6/5/93";
#else
static char rcsid[] = "$NetBSD: dumprmt.c,v 1.17 1997/06/05 16:10:47 mrg Exp $";
__RCSID("$NetBSD: dumprmt.c,v 1.18 1997/09/15 07:58:03 lukem Exp $");
#endif
#endif /* not lint */
@ -82,13 +83,20 @@ static int rmtstate = TS_CLOSED;
static int rmtape;
static char *rmtpeer;
static int okname __P((char *));
static int rmtcall __P((char *, char *));
static void rmtconnaborted __P((/* int, int */));
static int rmtgetb __P((void));
static void rmtgetconn __P((void));
static void rmtgets __P((char *, int));
static int rmtreply __P((char *));
static int okname __P((char *));
static int rmtcall __P((char *, char *));
void rmtclose __P((void));
static void rmtconnaborted __P((int));
static int rmtgetb __P((void));
static void rmtgetconn __P((void));
static void rmtgets __P((char *, int));
int rmthost __P((char *));
int rmtioctl __P((int, int));
int rmtopen __P((char *, int));
int rmtread __P((char *, int));
static int rmtreply __P((char *));
int rmtseek __P((int, int));
int rmtwrite __P((char *, int));
extern int ntrec; /* blocking factor on tape */
@ -110,7 +118,8 @@ rmthost(host)
}
static void
rmtconnaborted()
rmtconnaborted(dummy)
int dummy;
{
errx(1, "Lost connection to remote host.");
@ -221,7 +230,7 @@ rmtread(buf, count)
for (i = 0; i < n; i += cc) {
cc = read(rmtape, buf+i, n - i);
if (cc <= 0) {
rmtconnaborted();
rmtconnaborted(0);
}
}
return (n);
@ -240,6 +249,7 @@ rmtwrite(buf, count)
return (rmtreply("write"));
}
#if 0 /* XXX unused? */
void
rmtwrite0(count)
int count;
@ -265,6 +275,7 @@ rmtwrite2()
return (rmtreply("write"));
}
#endif
int
rmtseek(offset, pos)
@ -276,11 +287,12 @@ rmtseek(offset, pos)
return (rmtcall("seek", line));
}
struct mtget mts;
#if 0 /* XXX unused? */
struct mtget *
rmtstatus()
{
struct mtget mts;
int i;
char *cp;
@ -291,6 +303,7 @@ rmtstatus()
*cp++ = rmtgetb();
return (&mts);
}
#endif
int
rmtioctl(cmd, count)
@ -310,7 +323,7 @@ rmtcall(cmd, buf)
{
if (write(rmtape, buf, strlen(buf)) != strlen(buf))
rmtconnaborted();
rmtconnaborted(0);
return (rmtreply(cmd));
}
@ -339,7 +352,7 @@ rmtreply(cmd)
msg("Protocol to remote tape server botched (code \"%s\").\n",
code);
rmtconnaborted();
rmtconnaborted(0);
}
return (atoi(code + 1));
}
@ -350,7 +363,7 @@ rmtgetb()
char c;
if (read(rmtape, &c, 1) != 1)
rmtconnaborted();
rmtconnaborted(0);
return (c);
}
@ -374,5 +387,5 @@ rmtgets(line, len)
*cp = '\0';
msg("Protocol to remote tape server botched.\n");
msg("(rmtgets got \"%s\").\n", line);
rmtconnaborted();
rmtconnaborted(0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: itime.c,v 1.4 1997/04/15 01:09:50 lukem Exp $ */
/* $NetBSD: itime.c,v 1.5 1997/09/15 07:58:04 lukem Exp $ */
/*-
* Copyright (c) 1980, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)itime.c 8.1 (Berkeley) 6/5/93";
#else
static char rcsid[] = "$NetBSD: itime.c,v 1.4 1997/04/15 01:09:50 lukem Exp $";
__RCSID("$NetBSD: itime.c,v 1.5 1997/09/15 07:58:04 lukem Exp $");
#endif
#endif /* not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.14 1997/06/05 11:13:24 lukem Exp $ */
/* $NetBSD: main.c,v 1.15 1997/09/15 07:58:05 lukem Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@ -33,17 +33,17 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1980, 1991, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n";
__COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 4/15/94";
#else
static char rcsid[] = "$NetBSD: main.c,v 1.14 1997/06/05 11:13:24 lukem Exp $";
__RCSID("$NetBSD: main.c,v 1.15 1997/09/15 07:58:05 lukem Exp $");
#endif
#endif /* not lint */
@ -93,6 +93,7 @@ long dev_bsize = 1; /* recalculated below */
long blocksperfile; /* output blocks per file */
char *host = NULL; /* remote host (if any) */
int main __P((int, char *[]));
static long numarg __P((char *, long, long));
static void obsolete __P((int *, char **[]));
static void usage __P((void));
@ -517,6 +518,7 @@ main(argc, argv)
msg("DUMP IS DONE\n");
Exit(X_FINOK);
/* NOTREACHED */
exit(X_FINOK); /* XXX: to satisfy gcc */
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: optr.c,v 1.11 1997/05/27 08:34:36 mrg Exp $ */
/* $NetBSD: optr.c,v 1.12 1997/09/15 07:58:06 lukem Exp $ */
/*-
* Copyright (c) 1980, 1988, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)optr.c 8.2 (Berkeley) 1/6/94";
#else
static char rcsid[] = "$NetBSD: optr.c,v 1.11 1997/05/27 08:34:36 mrg Exp $";
__RCSID("$NetBSD: optr.c,v 1.12 1997/09/15 07:58:06 lukem Exp $");
#endif
#endif /* not lint */
@ -67,7 +68,8 @@ static char rcsid[] = "$NetBSD: optr.c,v 1.11 1997/05/27 08:34:36 mrg Exp $";
#include "dump.h"
#include "pathnames.h"
void alarmcatch __P((/* int, int */));
void alarmcatch __P((int));
struct fstab *allocfsent __P((struct fstab *fs));
int datesort __P((const void *, const void *));
static void sendmes __P((char *, char *));
@ -100,7 +102,7 @@ query(question)
quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno));
attnmessage = question;
timeout = 0;
alarmcatch();
alarmcatch(0);
back = -1;
errcount = 0;
do {
@ -144,7 +146,8 @@ char lastmsg[100];
* sleep for 2 minutes in case nobody comes to satisfy dump
*/
void
alarmcatch()
alarmcatch(dummy)
int dummy;
{
if (notify == 0) {
if (timeout == 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tape.c,v 1.11 1997/06/05 11:13:26 lukem Exp $ */
/* $NetBSD: tape.c,v 1.12 1997/09/15 07:58:08 lukem Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)tape.c 8.2 (Berkeley) 3/17/94";
#else
static char rcsid[] = "$NetBSD: tape.c,v 1.11 1997/06/05 11:13:26 lukem Exp $";
__RCSID("$NetBSD: tape.c,v 1.12 1997/09/15 07:58:08 lukem Exp $");
#endif
#endif /* not lint */
@ -84,12 +85,16 @@ extern int cartridge;
extern char *host;
char *nexttape;
static ssize_t atomic __P((ssize_t (*)(), int, char *, int));
static ssize_t atomic_read __P((int, char *, int));
static ssize_t atomic_write __P((int, char *, int));
static void doslave __P((int, int));
static void enslave __P((void));
static void flushtape __P((void));
static void killall __P((void));
static void proceed __P((int));
static void rollforward __P((void));
static void sigpipe __P((int));
static void tperror __P((int));
/*
* Concurrent dump mods (Caltech) - disk block reading and tape writing
@ -213,7 +218,7 @@ dumpblock(blkno, size)
int nogripe = 0;
void
static void
tperror(signo)
int signo;
{
@ -235,7 +240,7 @@ tperror(signo)
Exit(X_REWRITE);
}
void
static void
sigpipe(signo)
int signo;
{
@ -302,7 +307,7 @@ flushtape()
slp->req[trecno].count = 0; /* Sentinel */
if (atomic(write, slp->fd, (char *)slp->req, siz) != siz)
if (atomic_write(slp->fd, (char *)slp->req, siz) != siz)
quit("error writing command pipe: %s\n", strerror(errno));
slp->sent = 1; /* we sent a request, read the response later */
@ -313,7 +318,7 @@ flushtape()
/* Read results back from next slave */
if (slp->sent) {
if (atomic(read, slp->fd, (char *)&got, sizeof got)
if (atomic_read(slp->fd, (char *)&got, sizeof got)
!= sizeof got) {
perror(" DUMP: error reading command pipe in master");
dumpabort(0);
@ -330,7 +335,7 @@ flushtape()
*/
for (i = 0; i < SLAVES; i++) {
if (slaves[i].sent) {
if (atomic(read, slaves[i].fd,
if (atomic_read(slaves[i].fd,
(char *)&got, sizeof got)
!= sizeof got) {
perror(" DUMP: error reading command pipe in master");
@ -385,7 +390,7 @@ trewind()
* fixme: punt for now.
*/
if (slaves[f].sent) {
if (atomic(read, slaves[f].fd, (char *)&got, sizeof got)
if (atomic_read(slaves[f].fd, (char *)&got, sizeof got)
!= sizeof got) {
perror(" DUMP: error reading command pipe in master");
dumpabort(0);
@ -493,7 +498,7 @@ rollforward()
lastspclrec = savedtapea - 1;
}
size = (char *)ntb - (char *)q;
if (atomic(write, slp->fd, (char *)q, size) != size) {
if (atomic_write(slp->fd, (char *)q, size) != size) {
perror(" DUMP: error writing command pipe");
dumpabort(0);
}
@ -533,7 +538,7 @@ rollforward()
* worked ok, otherwise the tape is much too short!
*/
if (slp->sent) {
if (atomic(read, slp->fd, (char *)&got, sizeof got)
if (atomic_read(slp->fd, (char *)&got, sizeof got)
!= sizeof got) {
perror(" DUMP: error reading command pipe in master");
dumpabort(0);
@ -725,7 +730,7 @@ Exit(status)
/*
* proceed - handler for SIGUSR2, used to synchronize IO between the slaves.
*/
void
static void
proceed(signo)
int signo;
{
@ -773,7 +778,7 @@ enslave()
}
for (i = 0; i < SLAVES; i++)
(void) atomic(write, slaves[i].fd,
(void) atomic_write(slaves[i].fd,
(char *) &slaves[(i + 1) % SLAVES].pid,
sizeof slaves[0].pid);
@ -816,7 +821,7 @@ doslave(cmd, slave_number)
/*
* Need the pid of the next slave in the loop...
*/
if ((nread = atomic(read, cmd, (char *)&nextslave, sizeof nextslave))
if ((nread = atomic_read(cmd, (char *)&nextslave, sizeof nextslave))
!= sizeof nextslave) {
quit("master/slave protocol botched - didn't get pid of next slave.\n");
}
@ -824,7 +829,7 @@ doslave(cmd, slave_number)
/*
* Get list of blocks to dump, read the blocks into tape buffer
*/
while ((nread = atomic(read, cmd, (char *)slp->req, reqsiz)) == reqsiz) {
while ((nread = atomic_read(cmd, (char *)slp->req, reqsiz)) == reqsiz) {
struct req *p = slp->req;
for (trecno = 0; trecno < ntrec;
@ -833,7 +838,7 @@ doslave(cmd, slave_number)
bread(p->dblk, slp->tblock[trecno],
p->count * TP_BSIZE);
} else {
if (p->count != 1 || atomic(read, cmd,
if (p->count != 1 || atomic_read(cmd,
(char *)slp->tblock[trecno],
TP_BSIZE) != TP_BSIZE)
quit("master/slave protocol botched.\n");
@ -893,7 +898,7 @@ doslave(cmd, slave_number)
* pass size of write back to master
* (for EOT handling)
*/
(void) atomic(write, cmd, (char *)&size, sizeof size);
(void) atomic_write(cmd, (char *)&size, sizeof size);
}
/*
@ -908,19 +913,34 @@ doslave(cmd, slave_number)
/*
* Since a read from a pipe may not return all we asked for,
* or a write may not write all we ask if we get a signal,
* loop until the count is satisfied (or error).
*/
static ssize_t
atomic(func, fd, buf, count)
ssize_t (*func)();
atomic_read(fd, buf, count)
int fd;
char *buf;
int count;
{
ssize_t got, need = count;
while ((got = (*func)(fd, buf, need)) > 0 && (need -= got) > 0)
while ((got = read(fd, buf, need)) > 0 && (need -= got) > 0)
buf += got;
return (got < 0 ? got : count - need);
}
/*
* Since a write may not write all we ask if we get a signal,
* loop until the count is satisfied (or error).
*/
static ssize_t
atomic_write(fd, buf, count)
int fd;
char *buf;
int count;
{
ssize_t got, need = count;
while ((got = write(fd, buf, need)) > 0 && (need -= got) > 0)
buf += got;
return (got < 0 ? got : count - need);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: traverse.c,v 1.17 1997/06/05 11:13:27 lukem Exp $ */
/* $NetBSD: traverse.c,v 1.18 1997/09/15 07:58:09 lukem Exp $ */
/*-
* Copyright (c) 1980, 1988, 1991, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)traverse.c 8.2 (Berkeley) 9/23/93";
#else
static char rcsid[] = "$NetBSD: traverse.c,v 1.17 1997/06/05 11:13:27 lukem Exp $";
__RCSID("$NetBSD: traverse.c,v 1.18 1997/09/15 07:58:09 lukem Exp $");
#endif
#endif /* not lint */
@ -192,7 +193,7 @@ mapfiles(maxino, tapesize, disk, dirv)
dumpabort(0);
}
if ((dirh = fts_open(dirv, FTS_PHYSICAL|FTS_SEEDOT|FTS_XDEV,
(int (*)())NULL)) == NULL) {
NULL)) == NULL) {
msg("fts_open failed: %s\n", strerror(errno));
dumpabort(0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: unctime.c,v 1.10 1997/04/15 01:09:55 lukem Exp $ */
/* $NetBSD: unctime.c,v 1.11 1997/09/15 07:58:11 lukem Exp $ */
/*-
* Copyright (c) 1980, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)unctime.c 8.2 (Berkeley) 6/14/94";
#else
static char rcsid[] = "$NetBSD: unctime.c,v 1.10 1997/04/15 01:09:55 lukem Exp $";
__RCSID("$NetBSD: unctime.c,v 1.11 1997/09/15 07:58:11 lukem Exp $");
#endif
#endif /* not lint */
@ -50,10 +51,6 @@ static char rcsid[] = "$NetBSD: unctime.c,v 1.10 1997/04/15 01:09:55 lukem Exp $
#include <string.h>
#endif
#ifndef __P
#include <sys/cdefs.h>
#endif
/*
* Convert a ctime(3) format string into a system format date.
* Return the date thus calculated.
@ -73,6 +70,7 @@ static char rcsid[] = "$NetBSD: unctime.c,v 1.10 1997/04/15 01:09:55 lukem Exp $
#define E_YEAR 20
static int lookup __P((char *));
time_t unctime __P((char *));
time_t