mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-23 16:01:42 +00:00
o remove __P
o Use ANSI function definitions o unifdef -D__STDC__
This commit is contained in:
parent
97ec1da11a
commit
2db673ab00
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92837
@ -90,58 +90,54 @@ long dev_bsize; /* block size of underlying disk device */
|
||||
int dev_bshift; /* log2(dev_bsize) */
|
||||
int tp_bshift; /* log2(TP_BSIZE) */
|
||||
|
||||
#ifndef __P
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
/* operator interface functions */
|
||||
void broadcast __P((char *message));
|
||||
void infosch __P((int));
|
||||
void lastdump __P((int arg)); /* int should be char */
|
||||
void msg __P((const char *fmt, ...)) __printflike(1, 2);
|
||||
void msgtail __P((const char *fmt, ...)) __printflike(1, 2);
|
||||
int query __P((char *question));
|
||||
void quit __P((const char *fmt, ...)) __printflike(1, 2);
|
||||
void timeest __P((void));
|
||||
time_t unctime __P((char *str));
|
||||
void broadcast(const char *message);
|
||||
void infosch(int);
|
||||
void lastdump(int arg); /* int should be char */
|
||||
void msg(const char *fmt, ...) __printflike(1, 2);
|
||||
void msgtail(const char *fmt, ...) __printflike(1, 2);
|
||||
int query(const char *question);
|
||||
void quit(const char *fmt, ...) __printflike(1, 2);
|
||||
void timeest(void);
|
||||
time_t unctime(char *str);
|
||||
|
||||
/* mapping rouintes */
|
||||
struct dinode;
|
||||
long blockest __P((struct dinode *dp));
|
||||
int mapfiles __P((ino_t maxino, long *tapesize));
|
||||
int mapdirs __P((ino_t maxino, long *tapesize));
|
||||
long blockest(struct dinode *dp);
|
||||
int mapfiles(ino_t maxino, long *tapesize);
|
||||
int mapdirs(ino_t maxino, long *tapesize);
|
||||
|
||||
/* file dumping routines */
|
||||
void blksout __P((daddr_t *blkp, int frags, ino_t ino));
|
||||
void bread __P((daddr_t blkno, char *buf, int size));
|
||||
void dumpino __P((struct dinode *dp, ino_t ino));
|
||||
void dumpmap __P((char *map, int type, ino_t ino));
|
||||
void writeheader __P((ino_t ino));
|
||||
void blksout(daddr_t *blkp, int frags, ino_t ino);
|
||||
void bread(daddr_t blkno, char *buf, int size);
|
||||
void dumpino(struct dinode *dp, ino_t ino);
|
||||
void dumpmap(char *map, int type, ino_t ino);
|
||||
void writeheader(ino_t ino);
|
||||
|
||||
/* tape writing routines */
|
||||
int alloctape __P((void));
|
||||
void close_rewind __P((void));
|
||||
void dumpblock __P((daddr_t blkno, int size));
|
||||
void startnewtape __P((int top));
|
||||
void trewind __P((void));
|
||||
void writerec __P((char *dp, int isspcl));
|
||||
int alloctape(void);
|
||||
void close_rewind(void);
|
||||
void dumpblock(daddr_t blkno, int size);
|
||||
void startnewtape(int top);
|
||||
void trewind(void);
|
||||
void writerec(char *dp, int isspcl);
|
||||
|
||||
void Exit __P((int status)) __dead2;
|
||||
void dumpabort __P((int signo));
|
||||
void getfstab __P((void));
|
||||
void Exit(int status) __dead2;
|
||||
void dumpabort(int signo);
|
||||
void getfstab(void);
|
||||
|
||||
char *rawname __P((char *cp));
|
||||
struct dinode *getino __P((ino_t inum));
|
||||
char *rawname(char *cp);
|
||||
struct dinode *getino(ino_t inum);
|
||||
|
||||
/* rdump routines */
|
||||
#ifdef RDUMP
|
||||
void rmtclose __P((void));
|
||||
int rmthost __P((char *host));
|
||||
int rmtopen __P((char *tape, int mode));
|
||||
int rmtwrite __P((char *buf, int count));
|
||||
void rmtclose(void);
|
||||
int rmthost(const char *host);
|
||||
int rmtopen(const char *tape, int mode);
|
||||
int rmtwrite(const char *buf, int count);
|
||||
#endif /* RDUMP */
|
||||
|
||||
void interrupt __P((int signo)); /* in case operator bangs on console */
|
||||
void interrupt(int signo); /* in case operator bangs on console */
|
||||
|
||||
/*
|
||||
* Exit status codes
|
||||
@ -153,7 +149,7 @@ void interrupt __P((int signo)); /* in case operator bangs on console */
|
||||
|
||||
#define OPGRENT "operator" /* group entry to notify */
|
||||
|
||||
struct fstab *fstabsearch __P((char *key)); /* search fs_file and fs_spec */
|
||||
struct fstab *fstabsearch(const char *key); /* search fs_file and fs_spec */
|
||||
|
||||
#ifndef NAME_MAX
|
||||
#define NAME_MAX 255
|
||||
@ -171,25 +167,13 @@ struct dumpdates {
|
||||
int nddates; /* number of records (might be zero) */
|
||||
int ddates_in; /* we have read the increment file */
|
||||
struct dumpdates **ddatev; /* the arrayfied version */
|
||||
void initdumptimes __P((void));
|
||||
void getdumptime __P((void));
|
||||
void putdumptime __P((void));
|
||||
void initdumptimes(void);
|
||||
void getdumptime(void);
|
||||
void putdumptime(void);
|
||||
#define ITITERATE(i, ddp) \
|
||||
for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
|
||||
|
||||
void sig __P((int signo));
|
||||
|
||||
/*
|
||||
* Compatibility with old systems.
|
||||
*/
|
||||
#ifdef COMPAT
|
||||
#include <sys/file.h>
|
||||
#define strchr(a,b) index(a,b)
|
||||
#define strrchr(a,b) rindex(a,b)
|
||||
extern char *strdup(), *ctime();
|
||||
extern int read(), write();
|
||||
extern int errno;
|
||||
#endif
|
||||
void sig(int signo);
|
||||
|
||||
#ifndef _PATH_UTMP
|
||||
#define _PATH_UTMP "/etc/utmp"
|
||||
|
@ -57,12 +57,10 @@ static const char rcsid[] =
|
||||
#include <netdb.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#ifdef __STDC__
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "pathnames.h"
|
||||
#include "dump.h"
|
||||
@ -74,15 +72,15 @@ 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(const char *);
|
||||
static int rmtcall(const char *, const char *);
|
||||
static void rmtconnaborted(int);
|
||||
static int rmtgetb(void);
|
||||
static void rmtgetconn(void);
|
||||
static void rmtgets(char *, int);
|
||||
static int rmtreply(const char *);
|
||||
#ifdef KERBEROS
|
||||
int krcmd __P((char **, int /*u_short*/, char *, char *, int *, char *));
|
||||
int krcmd(char **, int /*u_short*/, char *, char *, int *, char *);
|
||||
#endif
|
||||
|
||||
static int errfd = -1;
|
||||
@ -90,15 +88,12 @@ extern int dokerberos;
|
||||
extern int ntrec; /* blocking factor on tape */
|
||||
|
||||
int
|
||||
rmthost(host)
|
||||
char *host;
|
||||
rmthost(const char *host)
|
||||
{
|
||||
|
||||
rmtpeer = malloc(strlen(host) + 1);
|
||||
if (rmtpeer)
|
||||
strcpy(rmtpeer, host);
|
||||
else
|
||||
rmtpeer = host;
|
||||
rmtpeer = strdup(host);
|
||||
if (rmtpeer == NULL)
|
||||
return (0);
|
||||
signal(SIGPIPE, rmtconnaborted);
|
||||
rmtgetconn();
|
||||
if (rmtape < 0)
|
||||
@ -107,7 +102,7 @@ rmthost(host)
|
||||
}
|
||||
|
||||
static void
|
||||
rmtconnaborted()
|
||||
rmtconnaborted(int sig __unused)
|
||||
{
|
||||
msg("Lost connection to remote host.\n");
|
||||
if (errfd != -1) {
|
||||
@ -134,7 +129,7 @@ rmtconnaborted()
|
||||
}
|
||||
|
||||
void
|
||||
rmtgetconn()
|
||||
rmtgetconn(void)
|
||||
{
|
||||
char *cp;
|
||||
const char *rmt;
|
||||
@ -201,10 +196,9 @@ rmtgetconn()
|
||||
}
|
||||
|
||||
static int
|
||||
okname(cp0)
|
||||
char *cp0;
|
||||
okname(const char *cp0)
|
||||
{
|
||||
char *cp;
|
||||
const char *cp;
|
||||
int c;
|
||||
|
||||
for (cp = cp0; *cp; cp++) {
|
||||
@ -218,9 +212,7 @@ okname(cp0)
|
||||
}
|
||||
|
||||
int
|
||||
rmtopen(tape, mode)
|
||||
char *tape;
|
||||
int mode;
|
||||
rmtopen(const char *tape, int mode)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
@ -230,7 +222,7 @@ rmtopen(tape, mode)
|
||||
}
|
||||
|
||||
void
|
||||
rmtclose()
|
||||
rmtclose(void)
|
||||
{
|
||||
|
||||
if (rmtstate != TS_OPEN)
|
||||
@ -240,9 +232,7 @@ rmtclose()
|
||||
}
|
||||
|
||||
int
|
||||
rmtread(buf, count)
|
||||
char *buf;
|
||||
int count;
|
||||
rmtread(char *buf, int count)
|
||||
{
|
||||
char line[30];
|
||||
int n, i, cc;
|
||||
@ -255,15 +245,13 @@ 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);
|
||||
}
|
||||
|
||||
int
|
||||
rmtwrite(buf, count)
|
||||
char *buf;
|
||||
int count;
|
||||
rmtwrite(const char *buf, int count)
|
||||
{
|
||||
char line[30];
|
||||
|
||||
@ -274,8 +262,7 @@ rmtwrite(buf, count)
|
||||
}
|
||||
|
||||
void
|
||||
rmtwrite0(count)
|
||||
int count;
|
||||
rmtwrite0(int count)
|
||||
{
|
||||
char line[30];
|
||||
|
||||
@ -284,24 +271,21 @@ rmtwrite0(count)
|
||||
}
|
||||
|
||||
void
|
||||
rmtwrite1(buf, count)
|
||||
char *buf;
|
||||
int count;
|
||||
rmtwrite1(const char *buf, int count)
|
||||
{
|
||||
|
||||
write(rmtape, buf, count);
|
||||
}
|
||||
|
||||
int
|
||||
rmtwrite2()
|
||||
rmtwrite2(void)
|
||||
{
|
||||
|
||||
return (rmtreply("write"));
|
||||
}
|
||||
|
||||
int
|
||||
rmtseek(offset, pos)
|
||||
int offset, pos;
|
||||
rmtseek(int offset, int pos) /* XXX off_t ? */
|
||||
{
|
||||
char line[80];
|
||||
|
||||
@ -312,7 +296,7 @@ rmtseek(offset, pos)
|
||||
struct mtget mts;
|
||||
|
||||
struct mtget *
|
||||
rmtstatus()
|
||||
rmtstatus(void)
|
||||
{
|
||||
int i;
|
||||
char *cp;
|
||||
@ -326,8 +310,7 @@ rmtstatus()
|
||||
}
|
||||
|
||||
int
|
||||
rmtioctl(cmd, count)
|
||||
int cmd, count;
|
||||
rmtioctl(int cmd, int count)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
@ -338,18 +321,16 @@ rmtioctl(cmd, count)
|
||||
}
|
||||
|
||||
static int
|
||||
rmtcall(cmd, buf)
|
||||
char *cmd, *buf;
|
||||
rmtcall(const char *cmd, const char *buf)
|
||||
{
|
||||
|
||||
if (write(rmtape, buf, strlen(buf)) != strlen(buf))
|
||||
rmtconnaborted();
|
||||
rmtconnaborted(0);
|
||||
return (rmtreply(cmd));
|
||||
}
|
||||
|
||||
static int
|
||||
rmtreply(cmd)
|
||||
char *cmd;
|
||||
rmtreply(const char *cmd)
|
||||
{
|
||||
char *cp;
|
||||
char code[30], emsg[BUFSIZ];
|
||||
@ -371,26 +352,24 @@ rmtreply(cmd)
|
||||
|
||||
msg("Protocol to remote tape server botched (code \"%s\").\n",
|
||||
code);
|
||||
rmtconnaborted();
|
||||
rmtconnaborted(0);
|
||||
}
|
||||
return (atoi(code + 1));
|
||||
}
|
||||
|
||||
int
|
||||
rmtgetb()
|
||||
rmtgetb(void)
|
||||
{
|
||||
char c;
|
||||
|
||||
if (read(rmtape, &c, 1) != 1)
|
||||
rmtconnaborted();
|
||||
rmtconnaborted(0);
|
||||
return (c);
|
||||
}
|
||||
|
||||
/* Get a line (guaranteed to have a trailing newline). */
|
||||
void
|
||||
rmtgets(line, len)
|
||||
char *line;
|
||||
int len;
|
||||
rmtgets(char *line, int len)
|
||||
{
|
||||
char *cp = line;
|
||||
|
||||
@ -406,5 +385,5 @@ rmtgets(line, len)
|
||||
*cp = '\0';
|
||||
msg("Protocol to remote tape server botched.\n");
|
||||
msg("(rmtgets got \"%s\").\n", line);
|
||||
rmtconnaborted();
|
||||
rmtconnaborted(0);
|
||||
}
|
||||
|
@ -50,10 +50,8 @@ static const char rcsid[] =
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "dump.h"
|
||||
|
||||
@ -66,13 +64,13 @@ struct dumpdates **ddatev = 0;
|
||||
int nddates = 0;
|
||||
int ddates_in = 0;
|
||||
|
||||
static void dumprecout __P((FILE *, struct dumpdates *));
|
||||
static int getrecord __P((FILE *, struct dumpdates *));
|
||||
static int makedumpdate __P((struct dumpdates *, char *));
|
||||
static void readdumptimes __P((FILE *));
|
||||
static void dumprecout(FILE *, const struct dumpdates *);
|
||||
static int getrecord(FILE *, struct dumpdates *);
|
||||
static int makedumpdate(struct dumpdates *, const char *);
|
||||
static void readdumptimes(FILE *);
|
||||
|
||||
void
|
||||
initdumptimes()
|
||||
initdumptimes(void)
|
||||
{
|
||||
FILE *df;
|
||||
|
||||
@ -104,8 +102,7 @@ initdumptimes()
|
||||
}
|
||||
|
||||
static void
|
||||
readdumptimes(df)
|
||||
FILE *df;
|
||||
readdumptimes(FILE *df)
|
||||
{
|
||||
int i;
|
||||
struct dumptime *dtwalk;
|
||||
@ -131,7 +128,7 @@ readdumptimes(df)
|
||||
}
|
||||
|
||||
void
|
||||
getdumptime()
|
||||
getdumptime(void)
|
||||
{
|
||||
struct dumpdates *ddp;
|
||||
int i;
|
||||
@ -163,7 +160,7 @@ getdumptime()
|
||||
}
|
||||
|
||||
void
|
||||
putdumptime()
|
||||
putdumptime(void)
|
||||
{
|
||||
FILE *df;
|
||||
struct dumpdates *dtwalk;
|
||||
@ -225,24 +222,18 @@ putdumptime()
|
||||
}
|
||||
|
||||
static void
|
||||
dumprecout(file, what)
|
||||
FILE *file;
|
||||
struct dumpdates *what;
|
||||
dumprecout(FILE *file, const struct dumpdates *what)
|
||||
{
|
||||
|
||||
if (fprintf(file, DUMPOUTFMT,
|
||||
what->dd_name,
|
||||
what->dd_level,
|
||||
ctime(&what->dd_ddate)) < 0)
|
||||
if (fprintf(file, DUMPOUTFMT, what->dd_name,
|
||||
what->dd_level, ctime(&what->dd_ddate)) < 0)
|
||||
quit("%s: %s\n", dumpdates, strerror(errno));
|
||||
}
|
||||
|
||||
int recno;
|
||||
|
||||
static int
|
||||
getrecord(df, ddatep)
|
||||
FILE *df;
|
||||
struct dumpdates *ddatep;
|
||||
getrecord(FILE *df, struct dumpdates *ddatep)
|
||||
{
|
||||
char tbuf[BUFSIZ];
|
||||
|
||||
@ -262,9 +253,7 @@ getrecord(df, ddatep)
|
||||
}
|
||||
|
||||
static int
|
||||
makedumpdate(ddp, tbuf)
|
||||
struct dumpdates *ddp;
|
||||
char *tbuf;
|
||||
makedumpdate(struct dumpdates *ddp, const char *tbuf)
|
||||
{
|
||||
char un_buf[128];
|
||||
|
||||
|
@ -82,14 +82,12 @@ long dev_bsize = 1; /* recalculated below */
|
||||
long blocksperfile; /* output blocks per file */
|
||||
char *host = NULL; /* remote host (if any) */
|
||||
|
||||
static long numarg __P((char *, long, long));
|
||||
static void obsolete __P((int *, char **[]));
|
||||
static void usage __P((void));
|
||||
static long numarg(const char *, long, long);
|
||||
static void obsolete(int *, char **[]);
|
||||
static void usage(void) __dead2;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct stat sb;
|
||||
ino_t ino;
|
||||
@ -513,7 +511,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: dump [-0123456789ac"
|
||||
@ -532,9 +530,7 @@ usage()
|
||||
* range (except that a vmax of 0 means unlimited).
|
||||
*/
|
||||
static long
|
||||
numarg(meaning, vmin, vmax)
|
||||
char *meaning;
|
||||
long vmin, vmax;
|
||||
numarg(const char *meaning, long vmin, long vmax)
|
||||
{
|
||||
char *p;
|
||||
long val;
|
||||
@ -548,8 +544,7 @@ numarg(meaning, vmin, vmax)
|
||||
}
|
||||
|
||||
void
|
||||
sig(signo)
|
||||
int signo;
|
||||
sig(int signo)
|
||||
{
|
||||
switch(signo) {
|
||||
case SIGALRM:
|
||||
@ -575,8 +570,7 @@ sig(signo)
|
||||
}
|
||||
|
||||
char *
|
||||
rawname(cp)
|
||||
char *cp;
|
||||
rawname(char *cp)
|
||||
{
|
||||
static char rawbuf[MAXPATHLEN];
|
||||
char *dp;
|
||||
@ -596,11 +590,10 @@ rawname(cp)
|
||||
if (dp == NULL)
|
||||
return (NULL);
|
||||
*dp = '\0';
|
||||
(void)strncpy(rawbuf, cp, MAXPATHLEN - 1);
|
||||
rawbuf[MAXPATHLEN-1] = '\0';
|
||||
(void)strlcpy(rawbuf, cp, MAXPATHLEN - 1);
|
||||
*dp = '/';
|
||||
(void)strncat(rawbuf, "/r", MAXPATHLEN - 1 - strlen(rawbuf));
|
||||
(void)strncat(rawbuf, dp + 1, MAXPATHLEN - 1 - strlen(rawbuf));
|
||||
(void)strlcat(rawbuf, "/r", MAXPATHLEN - 1 - strlen(rawbuf));
|
||||
(void)strlcat(rawbuf, dp + 1, MAXPATHLEN - 1 - strlen(rawbuf));
|
||||
return (rawbuf);
|
||||
}
|
||||
|
||||
@ -610,9 +603,7 @@ rawname(cp)
|
||||
* getopt(3) will like.
|
||||
*/
|
||||
static void
|
||||
obsolete(argcp, argvp)
|
||||
int *argcp;
|
||||
char **argvp[];
|
||||
obsolete(int *argcp, char **argvp[])
|
||||
{
|
||||
int argc, flags;
|
||||
char *ap, **argv, *flagsp, **nargv, *p;
|
||||
|
@ -58,8 +58,8 @@ static const char rcsid[] =
|
||||
#include "dump.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
void alarmcatch __P((/* int, int */));
|
||||
int datesort __P((const void *, const void *));
|
||||
void alarmcatch(int);
|
||||
int datesort(const void *, const void *);
|
||||
|
||||
/*
|
||||
* Query the operator; This previously-fascist piece of code
|
||||
@ -73,11 +73,10 @@ int datesort __P((const void *, const void *));
|
||||
* that dump needs attention.
|
||||
*/
|
||||
static int timeout;
|
||||
static char *attnmessage; /* attention message */
|
||||
static const char *attnmessage; /* attention message */
|
||||
|
||||
int
|
||||
query(question)
|
||||
char *question;
|
||||
query(const char *question)
|
||||
{
|
||||
char replybuffer[64];
|
||||
int back, errcount;
|
||||
@ -87,7 +86,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 {
|
||||
@ -124,7 +123,7 @@ char lastmsg[BUFSIZ];
|
||||
* sleep for 2 minutes in case nobody comes to satisfy dump
|
||||
*/
|
||||
void
|
||||
alarmcatch()
|
||||
alarmcatch(int sig __unused)
|
||||
{
|
||||
if (notify == 0) {
|
||||
if (timeout == 0)
|
||||
@ -150,8 +149,7 @@ alarmcatch()
|
||||
* Here if an inquisitive operator interrupts the dump program
|
||||
*/
|
||||
void
|
||||
interrupt(signo)
|
||||
int signo;
|
||||
interrupt(int signo __unused)
|
||||
{
|
||||
msg("Interrupt received.\n");
|
||||
if (query("Do you want to abort dump?"))
|
||||
@ -162,8 +160,7 @@ interrupt(signo)
|
||||
* We now use wall(1) to do the actual broadcasting.
|
||||
*/
|
||||
void
|
||||
broadcast(message)
|
||||
char *message;
|
||||
broadcast(const char *message)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[sizeof(_PATH_WALL) + sizeof(OPGRENT) + 3];
|
||||
@ -191,7 +188,7 @@ broadcast(message)
|
||||
time_t tschedule = 0;
|
||||
|
||||
void
|
||||
timeest()
|
||||
timeest(void)
|
||||
{
|
||||
double percent;
|
||||
time_t tnow;
|
||||
@ -219,20 +216,13 @@ timeest()
|
||||
* Schedule a printout of the estimate in the next call to timeest().
|
||||
*/
|
||||
void
|
||||
infosch(signal)
|
||||
int signal;
|
||||
infosch(int signal __unused)
|
||||
{
|
||||
tschedule = 0;
|
||||
}
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
msg(const char *fmt, ...)
|
||||
#else
|
||||
msg(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -240,11 +230,7 @@ msg(fmt, va_alist)
|
||||
#ifdef TDEBUG
|
||||
(void) fprintf(stderr, "pid=%d ", getpid());
|
||||
#endif
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void) vfprintf(stderr, fmt, ap);
|
||||
(void) fflush(stdout);
|
||||
(void) fflush(stderr);
|
||||
@ -253,32 +239,16 @@ msg(fmt, va_alist)
|
||||
}
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
msgtail(const char *fmt, ...)
|
||||
#else
|
||||
msgtail(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void) vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
quit(const char *fmt, ...)
|
||||
#else
|
||||
quit(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -286,11 +256,7 @@ quit(fmt, va_alist)
|
||||
#ifdef TDEBUG
|
||||
(void) fprintf(stderr, "pid=%d ", getpid());
|
||||
#endif
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void) vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
(void) fflush(stdout);
|
||||
@ -304,8 +270,7 @@ quit(fmt, va_alist)
|
||||
*/
|
||||
|
||||
struct fstab *
|
||||
allocfsent(fs)
|
||||
struct fstab *fs;
|
||||
allocfsent(const struct fstab *fs)
|
||||
{
|
||||
struct fstab *new;
|
||||
|
||||
@ -328,7 +293,7 @@ struct pfstab {
|
||||
static SLIST_HEAD(, pfstab) table;
|
||||
|
||||
void
|
||||
getfstab()
|
||||
getfstab(void)
|
||||
{
|
||||
struct fstab *fs;
|
||||
struct pfstab *pf;
|
||||
@ -359,8 +324,7 @@ getfstab()
|
||||
* The file name can omit the leading '/'.
|
||||
*/
|
||||
struct fstab *
|
||||
fstabsearch(key)
|
||||
char *key;
|
||||
fstabsearch(const char *key)
|
||||
{
|
||||
struct pfstab *pf;
|
||||
struct fstab *fs;
|
||||
@ -390,8 +354,7 @@ fstabsearch(key)
|
||||
* Tell the operator what to do
|
||||
*/
|
||||
void
|
||||
lastdump(arg)
|
||||
char arg; /* w ==> just what to do; W ==> most recent dumps */
|
||||
lastdump(int arg) /* w ==> just what to do; W ==> most recent dumps */
|
||||
{
|
||||
int i;
|
||||
struct fstab *dt;
|
||||
@ -438,8 +401,7 @@ lastdump(arg)
|
||||
}
|
||||
|
||||
int
|
||||
datesort(a1, a2)
|
||||
const void *a1, *a2;
|
||||
datesort(const void *a1, const void *a2)
|
||||
{
|
||||
struct dumpdates *d1 = *(struct dumpdates **)a1;
|
||||
struct dumpdates *d2 = *(struct dumpdates **)a2;
|
||||
|
@ -55,13 +55,9 @@ static const char rcsid[] =
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
int write(), read();
|
||||
#endif
|
||||
|
||||
#include "dump.h"
|
||||
|
||||
@ -75,12 +71,12 @@ extern int cartridge;
|
||||
extern char *host;
|
||||
char *nexttape;
|
||||
|
||||
static int atomic __P((ssize_t (*)(), 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 rollforward __P((void));
|
||||
static int atomic(ssize_t (*)(), int, char *, int);
|
||||
static void doslave(int, int);
|
||||
static void enslave(void);
|
||||
static void flushtape(void);
|
||||
static void killall(void);
|
||||
static void rollforward(void);
|
||||
|
||||
/*
|
||||
* Concurrent dump mods (Caltech) - disk block reading and tape writing
|
||||
@ -122,7 +118,7 @@ static jmp_buf jmpbuf; /* where to jump to if we are ready when the */
|
||||
/* SIGUSR2 arrives from the previous slave */
|
||||
|
||||
int
|
||||
alloctape()
|
||||
alloctape(void)
|
||||
{
|
||||
int pgoff = getpagesize() - 1;
|
||||
char *buf;
|
||||
@ -162,18 +158,13 @@ alloctape()
|
||||
}
|
||||
|
||||
void
|
||||
writerec(dp, isspcl)
|
||||
char *dp;
|
||||
int isspcl;
|
||||
writerec(char *dp, int isspcl)
|
||||
{
|
||||
|
||||
slp->req[trecno].dblk = (daddr_t)0;
|
||||
slp->req[trecno].count = 1;
|
||||
#ifndef __alpha__
|
||||
*(union u_spcl *)(*(nextblock)++) = *(union u_spcl *)dp;
|
||||
#else
|
||||
/* Can't do a structure assignment due to alignment problems */
|
||||
bcopy(dp, *(nextblock)++, sizeof (union u_spcl));
|
||||
#endif
|
||||
if (isspcl)
|
||||
lastspclrec = spcl.c_tapea;
|
||||
trecno++;
|
||||
@ -183,9 +174,7 @@ writerec(dp, isspcl)
|
||||
}
|
||||
|
||||
void
|
||||
dumpblock(blkno, size)
|
||||
daddr_t blkno;
|
||||
int size;
|
||||
dumpblock(daddr_t blkno, int size)
|
||||
{
|
||||
int avail, tpblks, dblkno;
|
||||
|
||||
@ -206,8 +195,7 @@ dumpblock(blkno, size)
|
||||
int nogripe = 0;
|
||||
|
||||
void
|
||||
tperror(signo)
|
||||
int signo;
|
||||
tperror(int signo __unused)
|
||||
{
|
||||
|
||||
if (pipeout) {
|
||||
@ -228,15 +216,14 @@ tperror(signo)
|
||||
}
|
||||
|
||||
void
|
||||
sigpipe(signo)
|
||||
int signo;
|
||||
sigpipe(int signo __unused)
|
||||
{
|
||||
|
||||
quit("Broken pipe\n");
|
||||
}
|
||||
|
||||
static void
|
||||
flushtape()
|
||||
flushtape(void)
|
||||
{
|
||||
int i, blks, got;
|
||||
long lastfirstrec;
|
||||
@ -313,7 +300,7 @@ flushtape()
|
||||
}
|
||||
|
||||
void
|
||||
trewind()
|
||||
trewind(void)
|
||||
{
|
||||
struct stat sb;
|
||||
int f;
|
||||
@ -394,7 +381,7 @@ close_rewind()
|
||||
}
|
||||
|
||||
void
|
||||
rollforward()
|
||||
rollforward(void)
|
||||
{
|
||||
struct req *p, *q, *prev;
|
||||
struct slave *tslp;
|
||||
@ -509,8 +496,7 @@ rollforward()
|
||||
* everything continues as if nothing had happened.
|
||||
*/
|
||||
void
|
||||
startnewtape(top)
|
||||
int top;
|
||||
startnewtape(int top)
|
||||
{
|
||||
int parentpid;
|
||||
int childpid;
|
||||
@ -642,8 +628,7 @@ startnewtape(top)
|
||||
}
|
||||
|
||||
void
|
||||
dumpabort(signo)
|
||||
int signo;
|
||||
dumpabort(int signo __unused)
|
||||
{
|
||||
|
||||
if (master != 0 && master != getpid())
|
||||
@ -674,8 +659,7 @@ Exit(status)
|
||||
* proceed - handler for SIGUSR2, used to synchronize IO between the slaves.
|
||||
*/
|
||||
void
|
||||
proceed(signo)
|
||||
int signo;
|
||||
proceed(int signo __unused)
|
||||
{
|
||||
|
||||
if (ready)
|
||||
@ -684,7 +668,7 @@ proceed(signo)
|
||||
}
|
||||
|
||||
void
|
||||
enslave()
|
||||
enslave(void)
|
||||
{
|
||||
int cmd[2];
|
||||
int i, j;
|
||||
@ -728,7 +712,7 @@ enslave()
|
||||
}
|
||||
|
||||
void
|
||||
killall()
|
||||
killall(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -747,9 +731,7 @@ killall()
|
||||
* get the lock back for the next cycle by swapping descriptors.
|
||||
*/
|
||||
static void
|
||||
doslave(cmd, slave_number)
|
||||
int cmd;
|
||||
int slave_number;
|
||||
doslave(int cmd, int slave_number)
|
||||
{
|
||||
int nread;
|
||||
int nextslave, size, wrote, eot_count;
|
||||
@ -863,11 +845,7 @@ doslave(cmd, slave_number)
|
||||
* loop until the count is satisfied (or error).
|
||||
*/
|
||||
static int
|
||||
atomic(func, fd, buf, count)
|
||||
ssize_t (*func)();
|
||||
int fd;
|
||||
char *buf;
|
||||
int count;
|
||||
atomic(ssize_t (*func)(), int fd, char *buf, int count)
|
||||
{
|
||||
int got, need = count;
|
||||
|
||||
|
@ -50,11 +50,9 @@ static const char rcsid[] =
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#ifdef __STDC__
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "dump.h"
|
||||
|
||||
@ -67,11 +65,11 @@ typedef quad_t fsizeT;
|
||||
typedef long fsizeT;
|
||||
#endif
|
||||
|
||||
static int dirindir __P((ino_t ino, daddr_t blkno, int level, long *size,
|
||||
long *tapesize, int nodump));
|
||||
static void dmpindir __P((ino_t ino, daddr_t blk, int level, fsizeT *size));
|
||||
static int searchdir __P((ino_t ino, daddr_t blkno, long size, long filesize,
|
||||
long *tapesize, int nodump));
|
||||
static int dirindir(ino_t ino, daddr_t blkno, int level, long *size,
|
||||
long *tapesize, int nodump);
|
||||
static void dmpindir(ino_t ino, daddr_t blk, int level, fsizeT *size);
|
||||
static int searchdir(ino_t ino, daddr_t blkno, long size, long filesize,
|
||||
long *tapesize, int nodump);
|
||||
|
||||
/*
|
||||
* This is an estimation of the number of TP_BSIZE blocks in the file.
|
||||
@ -81,8 +79,7 @@ static int searchdir __P((ino_t ino, daddr_t blkno, long size, long filesize,
|
||||
* hence the estimate may be high.
|
||||
*/
|
||||
long
|
||||
blockest(dp)
|
||||
struct dinode *dp;
|
||||
blockest(struct dinode *dp)
|
||||
{
|
||||
long blkest, sizeest;
|
||||
|
||||
@ -134,9 +131,7 @@ blockest(dp)
|
||||
* the directories in the filesystem.
|
||||
*/
|
||||
int
|
||||
mapfiles(maxino, tapesize)
|
||||
ino_t maxino;
|
||||
long *tapesize;
|
||||
mapfiles(ino_t maxino, long *tapesize)
|
||||
{
|
||||
int mode;
|
||||
ino_t ino;
|
||||
@ -191,9 +186,7 @@ mapfiles(maxino, tapesize)
|
||||
* pass using this algorithm.
|
||||
*/
|
||||
int
|
||||
mapdirs(maxino, tapesize)
|
||||
ino_t maxino;
|
||||
long *tapesize;
|
||||
mapdirs(ino_t maxino, long *tapesize)
|
||||
{
|
||||
struct dinode *dp;
|
||||
int i, isdir, nodump;
|
||||
@ -263,13 +256,8 @@ mapdirs(maxino, tapesize)
|
||||
* require the directory to be dumped.
|
||||
*/
|
||||
static int
|
||||
dirindir(ino, blkno, ind_level, filesize, tapesize, nodump)
|
||||
ino_t ino;
|
||||
daddr_t blkno;
|
||||
int ind_level;
|
||||
long *filesize;
|
||||
long *tapesize;
|
||||
int nodump;
|
||||
dirindir(ino_t ino, daddr_t blkno, int ind_level, long *filesize,
|
||||
long *tapesize, int nodump)
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
@ -305,13 +293,8 @@ dirindir(ino, blkno, ind_level, filesize, tapesize, nodump)
|
||||
* contains any subdirectories.
|
||||
*/
|
||||
static int
|
||||
searchdir(ino, blkno, size, filesize, tapesize, nodump)
|
||||
ino_t ino;
|
||||
daddr_t blkno;
|
||||
long size;
|
||||
long filesize;
|
||||
long *tapesize;
|
||||
int nodump;
|
||||
searchdir(ino_t ino, daddr_t blkno, long size, long filesize,
|
||||
long *tapesize, int nodump)
|
||||
{
|
||||
struct direct *dp;
|
||||
struct dinode *ip;
|
||||
@ -373,9 +356,7 @@ searchdir(ino, blkno, size, filesize, tapesize, nodump)
|
||||
* Dump the contents of an inode to tape.
|
||||
*/
|
||||
void
|
||||
dumpino(dp, ino)
|
||||
struct dinode *dp;
|
||||
ino_t ino;
|
||||
dumpino(struct dinode *dp, ino_t ino)
|
||||
{
|
||||
int ind_level, cnt;
|
||||
fsizeT size;
|
||||
@ -450,11 +431,7 @@ dumpino(dp, ino)
|
||||
* Read indirect blocks, and pass the data blocks to be dumped.
|
||||
*/
|
||||
static void
|
||||
dmpindir(ino, blk, ind_level, size)
|
||||
ino_t ino;
|
||||
daddr_t blk;
|
||||
int ind_level;
|
||||
fsizeT *size;
|
||||
dmpindir(ino_t ino, daddr_t blk, int ind_level, fsizeT *size)
|
||||
{
|
||||
int i, cnt;
|
||||
daddr_t idblk[MAXNINDIR];
|
||||
@ -484,10 +461,7 @@ dmpindir(ino, blk, ind_level, size)
|
||||
* Collect up the data into tape record sized buffers and output them.
|
||||
*/
|
||||
void
|
||||
blksout(blkp, frags, ino)
|
||||
daddr_t *blkp;
|
||||
int frags;
|
||||
ino_t ino;
|
||||
blksout(daddr_t *blkp, int frags, ino_t ino)
|
||||
{
|
||||
daddr_t *bp;
|
||||
int i, j, count, blks, tbperdb;
|
||||
@ -522,10 +496,7 @@ blksout(blkp, frags, ino)
|
||||
* Dump a map to the tape.
|
||||
*/
|
||||
void
|
||||
dumpmap(map, type, ino)
|
||||
char *map;
|
||||
int type;
|
||||
ino_t ino;
|
||||
dumpmap(char *map, int type, ino_t ino)
|
||||
{
|
||||
int i;
|
||||
char *cp;
|
||||
@ -541,8 +512,7 @@ dumpmap(map, type, ino)
|
||||
* Write a header record to the dump tape.
|
||||
*/
|
||||
void
|
||||
writeheader(ino)
|
||||
ino_t ino;
|
||||
writeheader(ino_t ino)
|
||||
{
|
||||
int32_t sum, cnt, *lp;
|
||||
|
||||
@ -563,8 +533,7 @@ writeheader(ino)
|
||||
}
|
||||
|
||||
struct dinode *
|
||||
getino(inum)
|
||||
ino_t inum;
|
||||
getino(ino_t inum)
|
||||
{
|
||||
static daddr_t minino, maxino;
|
||||
static struct dinode inoblock[MAXINOPB];
|
||||
@ -589,10 +558,7 @@ int breaderrors = 0;
|
||||
#define BREADEMAX 32
|
||||
|
||||
void
|
||||
bread(blkno, buf, size)
|
||||
daddr_t blkno;
|
||||
char *buf;
|
||||
int size;
|
||||
bread(daddr_t blkno, char *buf, int size)
|
||||
{
|
||||
int cnt, i;
|
||||
|
||||
|
@ -47,11 +47,8 @@ static const char rcsid[] =
|
||||
*
|
||||
* Return -1 if the string is not in ctime format.
|
||||
*/
|
||||
|
||||
|
||||
time_t
|
||||
unctime(str)
|
||||
char *str;
|
||||
unctime(char *str)
|
||||
{
|
||||
struct tm then;
|
||||
|
||||
|
@ -120,16 +120,16 @@ struct odirect {
|
||||
char d_name[ODIRSIZ];
|
||||
};
|
||||
|
||||
static struct inotab *allocinotab __P((ino_t, struct dinode *, long));
|
||||
static void dcvt __P((struct odirect *, struct direct *));
|
||||
static void flushent __P((void));
|
||||
static struct inotab *inotablookup __P((ino_t));
|
||||
static RST_DIR *opendirfile __P((const char *));
|
||||
static void putdir __P((char *, long));
|
||||
static void putent __P((struct direct *));
|
||||
static void rst_seekdir __P((RST_DIR *, long, long));
|
||||
static long rst_telldir __P((RST_DIR *));
|
||||
static struct direct *searchdir __P((ino_t, char *));
|
||||
static struct inotab *allocinotab(ino_t, struct dinode *, long);
|
||||
static void dcvt(struct odirect *, struct direct *);
|
||||
static void flushent(void);
|
||||
static struct inotab *inotablookup(ino_t);
|
||||
static RST_DIR *opendirfile(const char *);
|
||||
static void putdir(char *, long);
|
||||
static void putent(struct direct *);
|
||||
static void rst_seekdir(RST_DIR *, long, long);
|
||||
static long rst_telldir(RST_DIR *);
|
||||
static struct direct *searchdir(ino_t, char *);
|
||||
|
||||
/*
|
||||
* Extract directory contents, building up a directory structure
|
||||
@ -138,8 +138,7 @@ static struct direct *searchdir __P((ino_t, char *));
|
||||
* directories on the tape.
|
||||
*/
|
||||
void
|
||||
extractdirs(genmode)
|
||||
int genmode;
|
||||
extractdirs(int genmode)
|
||||
{
|
||||
int i;
|
||||
struct dinode *ip;
|
||||
@ -211,7 +210,7 @@ extractdirs(genmode)
|
||||
* skip over all the directories on the tape
|
||||
*/
|
||||
void
|
||||
skipdirs()
|
||||
skipdirs(void)
|
||||
{
|
||||
|
||||
while (curfile.dip && (curfile.dip->di_mode & IFMT) == IFDIR) {
|
||||
@ -224,10 +223,7 @@ skipdirs()
|
||||
* pname and pass them off to be processed.
|
||||
*/
|
||||
void
|
||||
treescan(pname, ino, todo)
|
||||
char *pname;
|
||||
ino_t ino;
|
||||
long (*todo) __P((char *, ino_t, int));
|
||||
treescan(char *pname, ino_t ino, long (*todo)(char *, ino_t, int))
|
||||
{
|
||||
struct inotab *itp;
|
||||
struct direct *dp;
|
||||
@ -291,8 +287,7 @@ treescan(pname, ino, todo)
|
||||
* Lookup a pathname which is always assumed to start from the ROOTINO.
|
||||
*/
|
||||
struct direct *
|
||||
pathsearch(pathname)
|
||||
const char *pathname;
|
||||
pathsearch(const char *pathname)
|
||||
{
|
||||
ino_t ino;
|
||||
struct direct *dp;
|
||||
@ -317,9 +312,7 @@ pathsearch(pathname)
|
||||
* Return its inode number if found, zero if it does not exist.
|
||||
*/
|
||||
static struct direct *
|
||||
searchdir(inum, name)
|
||||
ino_t inum;
|
||||
char *name;
|
||||
searchdir(ino_t inum, char *name)
|
||||
{
|
||||
struct direct *dp;
|
||||
struct inotab *itp;
|
||||
@ -342,9 +335,7 @@ searchdir(inum, name)
|
||||
* Put the directory entries in the directory file
|
||||
*/
|
||||
static void
|
||||
putdir(buf, size)
|
||||
char *buf;
|
||||
long size;
|
||||
putdir(char *buf, long size)
|
||||
{
|
||||
struct direct cvtbuf;
|
||||
struct odirect *odp;
|
||||
@ -414,8 +405,7 @@ long prev = 0;
|
||||
* add a new directory entry to a file.
|
||||
*/
|
||||
static void
|
||||
putent(dp)
|
||||
struct direct *dp;
|
||||
putent(struct direct *dp)
|
||||
{
|
||||
dp->d_reclen = DIRSIZ(0, dp);
|
||||
if (dirloc + dp->d_reclen > DIRBLKSIZ) {
|
||||
@ -433,7 +423,7 @@ putent(dp)
|
||||
* flush out a directory that is finished.
|
||||
*/
|
||||
static void
|
||||
flushent()
|
||||
flushent(void)
|
||||
{
|
||||
((struct direct *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev;
|
||||
(void) fwrite(dirbuf, (int)dirloc, 1, df);
|
||||
@ -442,9 +432,7 @@ flushent()
|
||||
}
|
||||
|
||||
static void
|
||||
dcvt(odp, ndp)
|
||||
struct odirect *odp;
|
||||
struct direct *ndp;
|
||||
dcvt(struct odirect *odp, struct direct *ndp)
|
||||
{
|
||||
|
||||
memset(ndp, 0, (long)(sizeof *ndp));
|
||||
@ -463,9 +451,7 @@ dcvt(odp, ndp)
|
||||
* the desired seek offset into it.
|
||||
*/
|
||||
static void
|
||||
rst_seekdir(dirp, loc, base)
|
||||
RST_DIR *dirp;
|
||||
long loc, base;
|
||||
rst_seekdir(RST_DIR *dirp, long loc, long base)
|
||||
{
|
||||
|
||||
if (loc == rst_telldir(dirp))
|
||||
@ -483,8 +469,7 @@ rst_seekdir(dirp, loc, base)
|
||||
* get next entry in a directory.
|
||||
*/
|
||||
struct direct *
|
||||
rst_readdir(dirp)
|
||||
RST_DIR *dirp;
|
||||
rst_readdir(RST_DIR *dirp)
|
||||
{
|
||||
struct direct *dp;
|
||||
|
||||
@ -524,8 +509,7 @@ rst_readdir(dirp)
|
||||
* Simulate the opening of a directory
|
||||
*/
|
||||
RST_DIR *
|
||||
rst_opendir(name)
|
||||
const char *name;
|
||||
rst_opendir(const char *name)
|
||||
{
|
||||
struct inotab *itp;
|
||||
RST_DIR *dirp;
|
||||
@ -544,8 +528,7 @@ rst_opendir(name)
|
||||
* In our case, there is nothing to do when closing a directory.
|
||||
*/
|
||||
void
|
||||
rst_closedir(dirp)
|
||||
RST_DIR *dirp;
|
||||
rst_closedir(RST_DIR *dirp)
|
||||
{
|
||||
|
||||
(void)close(dirp->dd_fd);
|
||||
@ -557,8 +540,7 @@ rst_closedir(dirp)
|
||||
* Simulate finding the current offset in the directory.
|
||||
*/
|
||||
static long
|
||||
rst_telldir(dirp)
|
||||
RST_DIR *dirp;
|
||||
rst_telldir(RST_DIR *dirp)
|
||||
{
|
||||
return ((long)lseek(dirp->dd_fd,
|
||||
(off_t)0, SEEK_CUR) - dirp->dd_size + dirp->dd_loc);
|
||||
@ -568,8 +550,7 @@ rst_telldir(dirp)
|
||||
* Open a directory file.
|
||||
*/
|
||||
static RST_DIR *
|
||||
opendirfile(name)
|
||||
const char *name;
|
||||
opendirfile(const char *name)
|
||||
{
|
||||
RST_DIR *dirp;
|
||||
int fd;
|
||||
@ -589,8 +570,7 @@ opendirfile(name)
|
||||
* Set the mode, owner, and times for all new or changed directories
|
||||
*/
|
||||
void
|
||||
setdirmodes(flags)
|
||||
int flags;
|
||||
setdirmodes(int flags)
|
||||
{
|
||||
FILE *mf;
|
||||
struct modeinfo node;
|
||||
@ -654,9 +634,7 @@ setdirmodes(flags)
|
||||
* Generate a literal copy of a directory.
|
||||
*/
|
||||
int
|
||||
genliteraldir(name, ino)
|
||||
char *name;
|
||||
ino_t ino;
|
||||
genliteraldir(char *name, ino_t ino)
|
||||
{
|
||||
struct inotab *itp;
|
||||
int ofile, dp, i, size;
|
||||
@ -699,8 +677,7 @@ genliteraldir(name, ino)
|
||||
* Determine the type of an inode
|
||||
*/
|
||||
int
|
||||
inodetype(ino)
|
||||
ino_t ino;
|
||||
inodetype(ino_t ino)
|
||||
{
|
||||
struct inotab *itp;
|
||||
|
||||
@ -715,10 +692,7 @@ inodetype(ino)
|
||||
* If requested, save its pertinent mode, owner, and time info.
|
||||
*/
|
||||
static struct inotab *
|
||||
allocinotab(ino, dip, seekpt)
|
||||
ino_t ino;
|
||||
struct dinode *dip;
|
||||
long seekpt;
|
||||
allocinotab(ino_t ino, struct dinode *dip, long seekpt)
|
||||
{
|
||||
struct inotab *itp;
|
||||
struct modeinfo node;
|
||||
@ -749,8 +723,7 @@ allocinotab(ino, dip, seekpt)
|
||||
* Look up an inode in the table of directories
|
||||
*/
|
||||
static struct inotab *
|
||||
inotablookup(ino)
|
||||
ino_t ino;
|
||||
inotablookup(ino_t ino)
|
||||
{
|
||||
struct inotab *itp;
|
||||
|
||||
@ -764,8 +737,7 @@ inotablookup(ino)
|
||||
* Clean up and exit
|
||||
*/
|
||||
void
|
||||
done(exitcode)
|
||||
int exitcode;
|
||||
done(int exitcode)
|
||||
{
|
||||
|
||||
closemt();
|
||||
|
@ -34,78 +34,78 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
struct entry *addentry __P((char *, ino_t, int));
|
||||
long addfile __P((char *, ino_t, int));
|
||||
int addwhiteout __P((char *));
|
||||
void badentry __P((struct entry *, char *));
|
||||
void canon __P((char *, char *, int));
|
||||
void checkrestore __P((void));
|
||||
void closemt __P((void));
|
||||
void createfiles __P((void));
|
||||
void createleaves __P((char *));
|
||||
void createlinks __P((void));
|
||||
long deletefile __P((char *, ino_t, int));
|
||||
void deleteino __P((ino_t));
|
||||
void delwhiteout __P((struct entry *));
|
||||
ino_t dirlookup __P((const char *));
|
||||
void done __P((int)) __dead2;
|
||||
void dumpsymtable __P((char *, long));
|
||||
void extractdirs __P((int));
|
||||
int extractfile __P((char *));
|
||||
void findunreflinks __P((void));
|
||||
char *flagvalues __P((struct entry *));
|
||||
void freeentry __P((struct entry *));
|
||||
void freename __P((char *));
|
||||
int genliteraldir __P((char *, ino_t));
|
||||
char *gentempname __P((struct entry *));
|
||||
void getfile __P((void (*)(char *, long), void (*)(char *, long)));
|
||||
void getvol __P((long));
|
||||
void initsymtable __P((char *));
|
||||
int inodetype __P((ino_t));
|
||||
int linkit __P((char *, char *, int));
|
||||
struct entry *lookupino __P((ino_t));
|
||||
struct entry *lookupname __P((char *));
|
||||
long listfile __P((char *, ino_t, int));
|
||||
ino_t lowerbnd __P((ino_t));
|
||||
void mktempname __P((struct entry *));
|
||||
void moveentry __P((struct entry *, char *));
|
||||
void msg __P((const char *, ...)) __printflike(1, 2);
|
||||
char *myname __P((struct entry *));
|
||||
void newnode __P((struct entry *));
|
||||
void newtapebuf __P((long));
|
||||
long nodeupdates __P((char *, ino_t, int));
|
||||
void onintr __P((int));
|
||||
void panic __P((const char *, ...)) __printflike(1, 2);
|
||||
void pathcheck __P((char *));
|
||||
struct direct *pathsearch __P((const char *));
|
||||
void printdumpinfo __P((void));
|
||||
void removeleaf __P((struct entry *));
|
||||
void removenode __P((struct entry *));
|
||||
void removeoldleaves __P((void));
|
||||
void removeoldnodes __P((void));
|
||||
void renameit __P((char *, char *));
|
||||
int reply __P((char *));
|
||||
RST_DIR *rst_opendir __P((const char *));
|
||||
struct direct *rst_readdir __P((RST_DIR *));
|
||||
void rst_closedir __P((RST_DIR *dirp));
|
||||
void runcmdshell __P((void));
|
||||
char *savename __P((char *));
|
||||
void setdirmodes __P((int));
|
||||
void setinput __P((char *));
|
||||
void setup __P((void));
|
||||
void skipdirs __P((void));
|
||||
void skipfile __P((void));
|
||||
void skipmaps __P((void));
|
||||
void swabst __P((u_char *, u_char *));
|
||||
void treescan __P((char *, ino_t, long (*)(char *, ino_t, int)));
|
||||
ino_t upperbnd __P((ino_t));
|
||||
long verifyfile __P((char *, ino_t, int));
|
||||
void xtrnull __P((char *, long));
|
||||
struct entry *addentry(char *, ino_t, int);
|
||||
long addfile(char *, ino_t, int);
|
||||
int addwhiteout(char *);
|
||||
void badentry(struct entry *, char *);
|
||||
void canon(char *, char *, int);
|
||||
void checkrestore(void);
|
||||
void closemt(void);
|
||||
void createfiles(void);
|
||||
void createleaves(char *);
|
||||
void createlinks(void);
|
||||
long deletefile(char *, ino_t, int);
|
||||
void deleteino(ino_t);
|
||||
void delwhiteout(struct entry *);
|
||||
ino_t dirlookup(const char *);
|
||||
void done(int) __dead2;
|
||||
void dumpsymtable(char *, long);
|
||||
void extractdirs(int);
|
||||
int extractfile(char *);
|
||||
void findunreflinks(void);
|
||||
char *flagvalues(struct entry *);
|
||||
void freeentry(struct entry *);
|
||||
void freename(char *);
|
||||
int genliteraldir(char *, ino_t);
|
||||
char *gentempname(struct entry *);
|
||||
void getfile(void (*)(char *, long), void (*)(char *, long));
|
||||
void getvol(long);
|
||||
void initsymtable(char *);
|
||||
int inodetype(ino_t);
|
||||
int linkit(char *, char *, int);
|
||||
struct entry *lookupino(ino_t);
|
||||
struct entry *lookupname(char *);
|
||||
long listfile(char *, ino_t, int);
|
||||
ino_t lowerbnd(ino_t);
|
||||
void mktempname(struct entry *);
|
||||
void moveentry(struct entry *, char *);
|
||||
void msg(const char *, ...) __printflike(1, 2);
|
||||
char *myname(struct entry *);
|
||||
void newnode(struct entry *);
|
||||
void newtapebuf(long);
|
||||
long nodeupdates(char *, ino_t, int);
|
||||
void onintr(int);
|
||||
void panic(const char *, ...) __printflike(1, 2);
|
||||
void pathcheck(char *);
|
||||
struct direct *pathsearch(const char *);
|
||||
void printdumpinfo(void);
|
||||
void removeleaf(struct entry *);
|
||||
void removenode(struct entry *);
|
||||
void removeoldleaves(void);
|
||||
void removeoldnodes(void);
|
||||
void renameit(char *, char *);
|
||||
int reply(char *);
|
||||
RST_DIR *rst_opendir(const char *);
|
||||
struct direct *rst_readdir(RST_DIR *);
|
||||
void rst_closedir(RST_DIR *dirp);
|
||||
void runcmdshell(void);
|
||||
char *savename(char *);
|
||||
void setdirmodes(int);
|
||||
void setinput(char *);
|
||||
void setup(void);
|
||||
void skipdirs(void);
|
||||
void skipfile(void);
|
||||
void skipmaps(void);
|
||||
void swabst(u_char *, u_char *);
|
||||
void treescan(char *, ino_t, long (*)(char *, ino_t, int));
|
||||
ino_t upperbnd(ino_t);
|
||||
long verifyfile(char *, ino_t, int);
|
||||
void xtrnull(char *, long);
|
||||
|
||||
/* From ../dump/dumprmt.c */
|
||||
void rmtclose __P((void));
|
||||
int rmthost __P((char *));
|
||||
int rmtioctl __P((int, int));
|
||||
int rmtopen __P((char *, int));
|
||||
int rmtread __P((char *, int));
|
||||
int rmtseek __P((int, int));
|
||||
void rmtclose(void);
|
||||
int rmthost(char *);
|
||||
int rmtioctl(int, int);
|
||||
int rmtopen(char *, int);
|
||||
int rmtread(char *, int);
|
||||
int rmtseek(int, int);
|
||||
|
@ -81,20 +81,20 @@ struct arglist {
|
||||
char *cmd; /* the current command */
|
||||
};
|
||||
|
||||
static char *copynext __P((char *, char *));
|
||||
static int fcmp __P((const void *, const void *));
|
||||
static void formatf __P((struct afile *, int));
|
||||
static void getcmd __P((char *, char *, char *, int, struct arglist *));
|
||||
struct dirent *glob_readdir __P((RST_DIR *dirp));
|
||||
static int glob_stat __P((const char *, struct stat *));
|
||||
static void mkentry __P((char *, struct direct *, struct afile *));
|
||||
static void printlist __P((char *, char *));
|
||||
static char *copynext(char *, char *);
|
||||
static int fcmp(const void *, const void *);
|
||||
static void formatf(struct afile *, int);
|
||||
static void getcmd(char *, char *, char *, int, struct arglist *);
|
||||
struct dirent *glob_readdir(RST_DIR *dirp);
|
||||
static int glob_stat(const char *, struct stat *);
|
||||
static void mkentry(char *, struct direct *, struct afile *);
|
||||
static void printlist(char *, char *);
|
||||
|
||||
/*
|
||||
* Read and execute commands from the terminal.
|
||||
*/
|
||||
void
|
||||
runcmdshell()
|
||||
runcmdshell(void)
|
||||
{
|
||||
struct entry *np;
|
||||
ino_t ino;
|
||||
@ -302,10 +302,7 @@ runcmdshell()
|
||||
* eliminate any embedded ".." components.
|
||||
*/
|
||||
static void
|
||||
getcmd(curdir, cmd, name, size, ap)
|
||||
char *curdir, *cmd, *name;
|
||||
struct arglist *ap;
|
||||
int size;
|
||||
getcmd(char *curdir, char *cmd, char *name, int size, struct arglist *ap)
|
||||
{
|
||||
char *cp;
|
||||
static char input[BUFSIZ];
|
||||
@ -390,8 +387,7 @@ getcmd(curdir, cmd, name, size, ap)
|
||||
* Strip off the next token of the input.
|
||||
*/
|
||||
static char *
|
||||
copynext(input, output)
|
||||
char *input, *output;
|
||||
copynext(char *input, char *output)
|
||||
{
|
||||
char *cp, *bp;
|
||||
char quote;
|
||||
@ -440,9 +436,7 @@ copynext(input, output)
|
||||
* remove any embedded "." and ".." components.
|
||||
*/
|
||||
void
|
||||
canon(rawname, canonname, len)
|
||||
char *rawname, *canonname;
|
||||
int len;
|
||||
canon(char *rawname, char *canonname, int len)
|
||||
{
|
||||
char *cp, *np;
|
||||
|
||||
@ -496,9 +490,7 @@ canon(rawname, canonname, len)
|
||||
* Do an "ls" style listing of a directory
|
||||
*/
|
||||
static void
|
||||
printlist(name, basename)
|
||||
char *name;
|
||||
char *basename;
|
||||
printlist(char *name, char *basename)
|
||||
{
|
||||
struct afile *fp, *list, *listp;
|
||||
struct direct *dp;
|
||||
@ -580,10 +572,7 @@ printlist(name, basename)
|
||||
* Read the contents of a directory.
|
||||
*/
|
||||
static void
|
||||
mkentry(name, dp, fp)
|
||||
char *name;
|
||||
struct direct *dp;
|
||||
struct afile *fp;
|
||||
mkentry(char *name, struct direct *dp, struct afile *fp)
|
||||
{
|
||||
char *cp;
|
||||
struct entry *np;
|
||||
@ -643,9 +632,7 @@ mkentry(name, dp, fp)
|
||||
* Print out a pretty listing of a directory
|
||||
*/
|
||||
static void
|
||||
formatf(list, nentry)
|
||||
struct afile *list;
|
||||
int nentry;
|
||||
formatf(struct afile *list, int nentry)
|
||||
{
|
||||
struct afile *fp, *endlist;
|
||||
int width, bigino, haveprefix, havepostfix;
|
||||
@ -716,8 +703,7 @@ formatf(list, nentry)
|
||||
#undef d_ino
|
||||
|
||||
struct dirent *
|
||||
glob_readdir(dirp)
|
||||
RST_DIR *dirp;
|
||||
glob_readdir(RST_DIR *dirp)
|
||||
{
|
||||
struct direct *dp;
|
||||
static struct dirent adirent;
|
||||
@ -740,9 +726,7 @@ glob_readdir(dirp)
|
||||
* Return st_mode information in response to stat or lstat calls
|
||||
*/
|
||||
static int
|
||||
glob_stat(name, stp)
|
||||
const char *name;
|
||||
struct stat *stp;
|
||||
glob_stat(const char *name, struct stat *stp)
|
||||
{
|
||||
struct direct *dp;
|
||||
|
||||
@ -761,8 +745,7 @@ glob_stat(name, stp)
|
||||
* Comparison routine for qsort.
|
||||
*/
|
||||
static int
|
||||
fcmp(f1, f2)
|
||||
const void *f1, *f2;
|
||||
fcmp(const void *f1, const void *f2)
|
||||
{
|
||||
return (strcmp(((struct afile *)f1)->fname,
|
||||
((struct afile *)f2)->fname));
|
||||
@ -772,8 +755,7 @@ fcmp(f1, f2)
|
||||
* respond to interrupts
|
||||
*/
|
||||
void
|
||||
onintr(signo)
|
||||
int signo;
|
||||
onintr(int signo)
|
||||
{
|
||||
if (command == 'i' && runshell)
|
||||
longjmp(reset, 1);
|
||||
|
@ -76,13 +76,11 @@ time_t dumptime;
|
||||
time_t dumpdate;
|
||||
FILE *terminal;
|
||||
|
||||
static void obsolete __P((int *, char **[]));
|
||||
static void usage __P((void));
|
||||
static void obsolete(int *, char **[]);
|
||||
static void usage(void) __dead2;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch;
|
||||
ino_t ino;
|
||||
@ -308,9 +306,7 @@ usage()
|
||||
* getopt(3) will like.
|
||||
*/
|
||||
static void
|
||||
obsolete(argcp, argvp)
|
||||
int *argcp;
|
||||
char **argvp[];
|
||||
obsolete(int *argcp, char **argvp[])
|
||||
{
|
||||
int argc, flags;
|
||||
char *ap, **argv, *flagsp, **nargv, *p;
|
||||
|
@ -49,17 +49,14 @@ static const char rcsid[] =
|
||||
#include "restore.h"
|
||||
#include "extern.h"
|
||||
|
||||
static char *keyval __P((int));
|
||||
static char *keyval(int);
|
||||
|
||||
/*
|
||||
* This implements the 't' option.
|
||||
* List entries on the tape.
|
||||
*/
|
||||
long
|
||||
listfile(name, ino, type)
|
||||
char *name;
|
||||
ino_t ino;
|
||||
int type;
|
||||
listfile(char *name, ino_t ino, int type)
|
||||
{
|
||||
long descend = hflag ? GOOD : FAIL;
|
||||
|
||||
@ -75,10 +72,7 @@ listfile(name, ino, type)
|
||||
* Request that new entries be extracted.
|
||||
*/
|
||||
long
|
||||
addfile(name, ino, type)
|
||||
char *name;
|
||||
ino_t ino;
|
||||
int type;
|
||||
addfile(char *name, ino_t ino, int type)
|
||||
{
|
||||
struct entry *ep;
|
||||
long descend = hflag ? GOOD : FAIL;
|
||||
@ -119,10 +113,7 @@ addfile(name, ino, type)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
long
|
||||
deletefile(name, ino, type)
|
||||
char *name;
|
||||
ino_t ino;
|
||||
int type;
|
||||
deletefile(char *name, ino_t ino, int type)
|
||||
{
|
||||
long descend = hflag ? GOOD : FAIL;
|
||||
struct entry *ep;
|
||||
@ -160,7 +151,7 @@ static struct entry *removelist;
|
||||
* Remove directories from the lookup chains.
|
||||
*/
|
||||
void
|
||||
removeoldleaves()
|
||||
removeoldleaves(void)
|
||||
{
|
||||
struct entry *ep, *nextep;
|
||||
ino_t i, mydirino;
|
||||
@ -213,10 +204,7 @@ removeoldleaves()
|
||||
* Renames are done at the same time.
|
||||
*/
|
||||
long
|
||||
nodeupdates(name, ino, type)
|
||||
char *name;
|
||||
ino_t ino;
|
||||
int type;
|
||||
nodeupdates(char *name, ino_t ino, int type)
|
||||
{
|
||||
struct entry *ep, *np, *ip;
|
||||
long descend = GOOD;
|
||||
@ -502,8 +490,7 @@ nodeupdates(name, ino, type)
|
||||
* Calculate the active flags in a key.
|
||||
*/
|
||||
static char *
|
||||
keyval(key)
|
||||
int key;
|
||||
keyval(int key)
|
||||
{
|
||||
static char keybuf[32];
|
||||
|
||||
@ -524,7 +511,7 @@ keyval(key)
|
||||
* Find unreferenced link names.
|
||||
*/
|
||||
void
|
||||
findunreflinks()
|
||||
findunreflinks(void)
|
||||
{
|
||||
struct entry *ep, *np;
|
||||
ino_t i;
|
||||
@ -572,7 +559,7 @@ findunreflinks()
|
||||
* time O(N).
|
||||
*/
|
||||
void
|
||||
removeoldnodes()
|
||||
removeoldnodes(void)
|
||||
{
|
||||
struct entry *ep, **prev;
|
||||
long change;
|
||||
@ -601,8 +588,7 @@ removeoldnodes()
|
||||
* Extract new leaves.
|
||||
*/
|
||||
void
|
||||
createleaves(symtabfile)
|
||||
char *symtabfile;
|
||||
createleaves(char *symtabfile)
|
||||
{
|
||||
struct entry *ep;
|
||||
ino_t first;
|
||||
@ -681,7 +667,7 @@ createleaves(symtabfile)
|
||||
* Efficiently extract a subset of the files on a tape.
|
||||
*/
|
||||
void
|
||||
createfiles()
|
||||
createfiles(void)
|
||||
{
|
||||
ino_t first, next, last;
|
||||
struct entry *ep;
|
||||
@ -777,7 +763,7 @@ createfiles()
|
||||
* Add links.
|
||||
*/
|
||||
void
|
||||
createlinks()
|
||||
createlinks(void)
|
||||
{
|
||||
struct entry *np, *ep;
|
||||
ino_t i;
|
||||
@ -817,7 +803,7 @@ createlinks()
|
||||
* that no temporary names remain.
|
||||
*/
|
||||
void
|
||||
checkrestore()
|
||||
checkrestore(void)
|
||||
{
|
||||
struct entry *ep;
|
||||
ino_t i;
|
||||
@ -839,10 +825,7 @@ checkrestore()
|
||||
* A paranoid check that things are as they should be.
|
||||
*/
|
||||
long
|
||||
verifyfile(name, ino, type)
|
||||
char *name;
|
||||
ino_t ino;
|
||||
int type;
|
||||
verifyfile(char *name, ino_t ino, int type)
|
||||
{
|
||||
struct entry *np, *ep;
|
||||
long descend = GOOD;
|
||||
|
@ -74,16 +74,15 @@ static const char rcsid[] =
|
||||
static struct entry **entry;
|
||||
static long entrytblsize;
|
||||
|
||||
static void addino __P((ino_t, struct entry *));
|
||||
static struct entry *lookupparent __P((char *));
|
||||
static void removeentry __P((struct entry *));
|
||||
static void addino(ino_t, struct entry *);
|
||||
static struct entry *lookupparent(char *);
|
||||
static void removeentry(struct entry *);
|
||||
|
||||
/*
|
||||
* Look up an entry by inode number
|
||||
*/
|
||||
struct entry *
|
||||
lookupino(inum)
|
||||
ino_t inum;
|
||||
lookupino(ino_t inum)
|
||||
{
|
||||
struct entry *ep;
|
||||
|
||||
@ -99,9 +98,7 @@ lookupino(inum)
|
||||
* Add an entry into the entry table
|
||||
*/
|
||||
static void
|
||||
addino(inum, np)
|
||||
ino_t inum;
|
||||
struct entry *np;
|
||||
addino(ino_t inum, struct entry *np)
|
||||
{
|
||||
struct entry **epp;
|
||||
|
||||
@ -121,8 +118,7 @@ addino(inum, np)
|
||||
* Delete an entry from the entry table
|
||||
*/
|
||||
void
|
||||
deleteino(inum)
|
||||
ino_t inum;
|
||||
deleteino(ino_t inum)
|
||||
{
|
||||
struct entry *next;
|
||||
struct entry **prev;
|
||||
@ -145,8 +141,7 @@ deleteino(inum)
|
||||
* Look up an entry by name
|
||||
*/
|
||||
struct entry *
|
||||
lookupname(name)
|
||||
char *name;
|
||||
lookupname(char *name)
|
||||
{
|
||||
struct entry *ep;
|
||||
char *np, *cp;
|
||||
@ -175,8 +170,7 @@ lookupname(name)
|
||||
* Look up the parent of a pathname
|
||||
*/
|
||||
static struct entry *
|
||||
lookupparent(name)
|
||||
char *name;
|
||||
lookupparent(char *name)
|
||||
{
|
||||
struct entry *ep;
|
||||
char *tailindex;
|
||||
@ -198,8 +192,7 @@ lookupparent(name)
|
||||
* Determine the current pathname of a node or leaf
|
||||
*/
|
||||
char *
|
||||
myname(ep)
|
||||
struct entry *ep;
|
||||
myname(struct entry *ep)
|
||||
{
|
||||
char *cp;
|
||||
static char namebuf[MAXPATHLEN];
|
||||
@ -226,10 +219,7 @@ static struct entry *freelist = NULL;
|
||||
* add an entry to the symbol table
|
||||
*/
|
||||
struct entry *
|
||||
addentry(name, inum, type)
|
||||
char *name;
|
||||
ino_t inum;
|
||||
int type;
|
||||
addentry(char *name, ino_t inum, int type)
|
||||
{
|
||||
struct entry *np, *ep;
|
||||
|
||||
@ -277,8 +267,7 @@ addentry(name, inum, type)
|
||||
* delete an entry from the symbol table
|
||||
*/
|
||||
void
|
||||
freeentry(ep)
|
||||
struct entry *ep;
|
||||
freeentry(struct entry *ep)
|
||||
{
|
||||
struct entry *np;
|
||||
ino_t inum;
|
||||
@ -321,9 +310,7 @@ freeentry(ep)
|
||||
* Relocate an entry in the tree structure
|
||||
*/
|
||||
void
|
||||
moveentry(ep, newname)
|
||||
struct entry *ep;
|
||||
char *newname;
|
||||
moveentry(struct entry *ep, char *newname)
|
||||
{
|
||||
struct entry *np;
|
||||
char *cp;
|
||||
@ -351,8 +338,7 @@ moveentry(ep, newname)
|
||||
* Remove an entry in the tree structure
|
||||
*/
|
||||
static void
|
||||
removeentry(ep)
|
||||
struct entry *ep;
|
||||
removeentry(struct entry *ep)
|
||||
{
|
||||
struct entry *np;
|
||||
|
||||
@ -397,8 +383,7 @@ static struct strhdr strtblhdr[allocsize(NAME_MAX) / STRTBLINCR];
|
||||
* has an appropriate sized entry, and if not allocates a new one.
|
||||
*/
|
||||
char *
|
||||
savename(name)
|
||||
char *name;
|
||||
savename(char *name)
|
||||
{
|
||||
struct strhdr *np;
|
||||
long len;
|
||||
@ -425,8 +410,7 @@ savename(name)
|
||||
* appropriate free list.
|
||||
*/
|
||||
void
|
||||
freename(name)
|
||||
char *name;
|
||||
freename(char *name)
|
||||
{
|
||||
struct strhdr *tp, *np;
|
||||
|
||||
@ -453,9 +437,7 @@ struct symtableheader {
|
||||
* dump a snapshot of the symbol table
|
||||
*/
|
||||
void
|
||||
dumpsymtable(filename, checkpt)
|
||||
char *filename;
|
||||
long checkpt;
|
||||
dumpsymtable(char *filename, long checkpt)
|
||||
{
|
||||
struct entry *ep, *tep;
|
||||
ino_t i;
|
||||
@ -541,8 +523,7 @@ dumpsymtable(filename, checkpt)
|
||||
* Initialize a symbol table from a file
|
||||
*/
|
||||
void
|
||||
initsymtable(filename)
|
||||
char *filename;
|
||||
initsymtable(char *filename)
|
||||
{
|
||||
char *base;
|
||||
long tblsize;
|
||||
|
@ -91,23 +91,23 @@ static int Qcvt; /* Swap quads (for sun) */
|
||||
|
||||
#define FLUSHTAPEBUF() blkcnt = ntrec + 1
|
||||
|
||||
static void accthdr __P((struct s_spcl *));
|
||||
static int checksum __P((int *));
|
||||
static void findinode __P((struct s_spcl *));
|
||||
static void findtapeblksize __P((void));
|
||||
static int gethead __P((struct s_spcl *));
|
||||
static void readtape __P((char *));
|
||||
static void setdumpnum __P((void));
|
||||
static u_long swabl __P((u_long));
|
||||
static u_char *swablong __P((u_char *, int));
|
||||
static u_char *swabshort __P((u_char *, int));
|
||||
static void terminateinput __P((void));
|
||||
static void xtrfile __P((char *, long));
|
||||
static void xtrlnkfile __P((char *, long));
|
||||
static void xtrlnkskip __P((char *, long));
|
||||
static void xtrmap __P((char *, long));
|
||||
static void xtrmapskip __P((char *, long));
|
||||
static void xtrskip __P((char *, long));
|
||||
static void accthdr(struct s_spcl *);
|
||||
static int checksum(int *);
|
||||
static void findinode(struct s_spcl *);
|
||||
static void findtapeblksize(void);
|
||||
static int gethead(struct s_spcl *);
|
||||
static void readtape(char *);
|
||||
static void setdumpnum(void);
|
||||
static u_long swabl(u_long);
|
||||
static u_char *swablong(u_char *, int);
|
||||
static u_char *swabshort(u_char *, int);
|
||||
static void terminateinput(void);
|
||||
static void xtrfile(char *, long);
|
||||
static void xtrlnkfile(char *, long);
|
||||
static void xtrlnkskip(char *, long);
|
||||
static void xtrmap(char *, long);
|
||||
static void xtrmapskip(char *, long);
|
||||
static void xtrskip(char *, long);
|
||||
|
||||
static int readmapflag;
|
||||
|
||||
@ -115,8 +115,7 @@ static int readmapflag;
|
||||
* Set up an input source
|
||||
*/
|
||||
void
|
||||
setinput(source)
|
||||
char *source;
|
||||
setinput(char *source)
|
||||
{
|
||||
FLUSHTAPEBUF();
|
||||
if (bflag)
|
||||
@ -161,10 +160,9 @@ setinput(source)
|
||||
}
|
||||
|
||||
void
|
||||
newtapebuf(size)
|
||||
long size;
|
||||
newtapebuf(long size)
|
||||
{
|
||||
static tapebufsize = -1;
|
||||
static int tapebufsize = -1;
|
||||
|
||||
ntrec = size;
|
||||
if (size <= tapebufsize)
|
||||
@ -184,7 +182,7 @@ newtapebuf(size)
|
||||
* that it actually is a dump tape.
|
||||
*/
|
||||
void
|
||||
setup()
|
||||
setup(void)
|
||||
{
|
||||
int i, j, *ip;
|
||||
struct stat stbuf;
|
||||
@ -296,8 +294,7 @@ setup()
|
||||
* the user when only extracting a subset of the files.
|
||||
*/
|
||||
void
|
||||
getvol(nextvol)
|
||||
long nextvol;
|
||||
getvol(long nextvol)
|
||||
{
|
||||
long newvol, prevtapea, savecnt, i;
|
||||
union u_spcl tmpspcl;
|
||||
@ -469,7 +466,7 @@ getvol(nextvol)
|
||||
* Handle unexpected EOF.
|
||||
*/
|
||||
static void
|
||||
terminateinput()
|
||||
terminateinput(void)
|
||||
{
|
||||
|
||||
if (gettingfile && curfile.action == USING) {
|
||||
@ -491,7 +488,7 @@ terminateinput()
|
||||
* appropriate one.
|
||||
*/
|
||||
static void
|
||||
setdumpnum()
|
||||
setdumpnum(void)
|
||||
{
|
||||
struct mtop tcom;
|
||||
|
||||
@ -513,7 +510,7 @@ setdumpnum()
|
||||
}
|
||||
|
||||
void
|
||||
printdumpinfo()
|
||||
printdumpinfo(void)
|
||||
{
|
||||
time_t t;
|
||||
t = _time32_to_time(spcl.c_date);
|
||||
@ -529,8 +526,7 @@ printdumpinfo()
|
||||
}
|
||||
|
||||
int
|
||||
extractfile(name)
|
||||
char *name;
|
||||
extractfile(char *name)
|
||||
{
|
||||
int flags;
|
||||
mode_t mode;
|
||||
@ -652,7 +648,7 @@ extractfile(name)
|
||||
* skip over bit maps on the tape
|
||||
*/
|
||||
void
|
||||
skipmaps()
|
||||
skipmaps(void)
|
||||
{
|
||||
|
||||
while (spcl.c_type == TS_BITS || spcl.c_type == TS_CLRI)
|
||||
@ -663,7 +659,7 @@ skipmaps()
|
||||
* skip over a file on the tape
|
||||
*/
|
||||
void
|
||||
skipfile()
|
||||
skipfile(void)
|
||||
{
|
||||
|
||||
curfile.action = SKIP;
|
||||
@ -677,9 +673,7 @@ skipfile()
|
||||
* to the skip function.
|
||||
*/
|
||||
void
|
||||
getfile(fill, skip)
|
||||
void (*fill) __P((char *, long));
|
||||
void (*skip) __P((char *, long));
|
||||
getfile(void (*fill)(char *, long), void (*skip)(char *, long))
|
||||
{
|
||||
int i;
|
||||
int curblk = 0;
|
||||
@ -738,9 +732,7 @@ getfile(fill, skip)
|
||||
* Write out the next block of a file.
|
||||
*/
|
||||
static void
|
||||
xtrfile(buf, size)
|
||||
char *buf;
|
||||
long size;
|
||||
xtrfile(char *buf, long size)
|
||||
{
|
||||
|
||||
if (Nflag)
|
||||
@ -757,9 +749,7 @@ xtrfile(buf, size)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
xtrskip(buf, size)
|
||||
char *buf;
|
||||
long size;
|
||||
xtrskip(char *buf, long size)
|
||||
{
|
||||
|
||||
if (lseek(ofile, size, SEEK_CUR) == -1) {
|
||||
@ -774,9 +764,7 @@ xtrskip(buf, size)
|
||||
* Collect the next block of a symbolic link.
|
||||
*/
|
||||
static void
|
||||
xtrlnkfile(buf, size)
|
||||
char *buf;
|
||||
long size;
|
||||
xtrlnkfile(char *buf, long size)
|
||||
{
|
||||
|
||||
pathlen += size;
|
||||
@ -793,9 +781,7 @@ xtrlnkfile(buf, size)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
xtrlnkskip(buf, size)
|
||||
char *buf;
|
||||
long size;
|
||||
xtrlnkskip(char *buf, long size)
|
||||
{
|
||||
|
||||
fprintf(stderr, "unallocated block in symbolic link %s\n",
|
||||
@ -807,9 +793,7 @@ xtrlnkskip(buf, size)
|
||||
* Collect the next block of a bit map.
|
||||
*/
|
||||
static void
|
||||
xtrmap(buf, size)
|
||||
char *buf;
|
||||
long size;
|
||||
xtrmap(char *buf, long size)
|
||||
{
|
||||
|
||||
memmove(map, buf, size);
|
||||
@ -821,9 +805,7 @@ xtrmap(buf, size)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
xtrmapskip(buf, size)
|
||||
char *buf;
|
||||
long size;
|
||||
xtrmapskip(char *buf, long size)
|
||||
{
|
||||
|
||||
panic("hole in map\n");
|
||||
@ -835,9 +817,7 @@ xtrmapskip(buf, size)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
void
|
||||
xtrnull(buf, size)
|
||||
char *buf;
|
||||
long size;
|
||||
xtrnull(char *buf, long size)
|
||||
{
|
||||
|
||||
return;
|
||||
@ -848,8 +828,7 @@ xtrnull(buf, size)
|
||||
* Handle read errors, and end of media.
|
||||
*/
|
||||
static void
|
||||
readtape(buf)
|
||||
char *buf;
|
||||
readtape(char *buf)
|
||||
{
|
||||
long rd, newvol, i;
|
||||
int cnt, seek_failed;
|
||||
@ -967,7 +946,7 @@ readtape(buf)
|
||||
}
|
||||
|
||||
static void
|
||||
findtapeblksize()
|
||||
findtapeblksize(void)
|
||||
{
|
||||
long i;
|
||||
|
||||
@ -996,7 +975,7 @@ findtapeblksize()
|
||||
}
|
||||
|
||||
void
|
||||
closemt()
|
||||
closemt(void)
|
||||
{
|
||||
|
||||
if (mt < 0)
|
||||
@ -1016,8 +995,7 @@ closemt()
|
||||
* If it is not any valid header, return an error.
|
||||
*/
|
||||
static int
|
||||
gethead(buf)
|
||||
struct s_spcl *buf;
|
||||
gethead(struct s_spcl *buf)
|
||||
{
|
||||
long i;
|
||||
union {
|
||||
@ -1165,8 +1143,7 @@ gethead(buf)
|
||||
* Check that a header is where it belongs and predict the next header
|
||||
*/
|
||||
static void
|
||||
accthdr(header)
|
||||
struct s_spcl *header;
|
||||
accthdr(struct s_spcl *header)
|
||||
{
|
||||
static ino_t previno = 0x7fffffff;
|
||||
static int prevtype;
|
||||
@ -1223,8 +1200,7 @@ accthdr(header)
|
||||
* Complain if had to skip.
|
||||
*/
|
||||
static void
|
||||
findinode(header)
|
||||
struct s_spcl *header;
|
||||
findinode(struct s_spcl *header)
|
||||
{
|
||||
static long skipcnt = 0;
|
||||
long i;
|
||||
@ -1296,8 +1272,7 @@ findinode(header)
|
||||
}
|
||||
|
||||
static int
|
||||
checksum(buf)
|
||||
int *buf;
|
||||
checksum(int *buf)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
@ -1324,36 +1299,20 @@ checksum(buf)
|
||||
}
|
||||
|
||||
#ifdef RRESTORE
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
msg(const char *fmt, ...)
|
||||
#else
|
||||
msg(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif /* RRESTORE */
|
||||
|
||||
static u_char *
|
||||
swabshort(sp, n)
|
||||
u_char *sp;
|
||||
int n;
|
||||
swabshort(u_char *sp, int n)
|
||||
{
|
||||
char c;
|
||||
|
||||
@ -1365,9 +1324,7 @@ swabshort(sp, n)
|
||||
}
|
||||
|
||||
static u_char *
|
||||
swablong(sp, n)
|
||||
u_char *sp;
|
||||
int n;
|
||||
swablong(u_char *sp, int n)
|
||||
{
|
||||
char c;
|
||||
|
||||
@ -1380,8 +1337,7 @@ swablong(sp, n)
|
||||
}
|
||||
|
||||
void
|
||||
swabst(cp, sp)
|
||||
u_char *cp, *sp;
|
||||
swabst(u_char *cp, u_char *sp)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
@ -1416,8 +1372,7 @@ swabst(cp, sp)
|
||||
}
|
||||
|
||||
static u_long
|
||||
swabl(x)
|
||||
u_long x;
|
||||
swabl(u_long x)
|
||||
{
|
||||
swabst((u_char *)"l", (u_char *)&x);
|
||||
return (x);
|
||||
|
@ -58,8 +58,7 @@ static const char rcsid[] =
|
||||
* Insure that all the components of a pathname exist.
|
||||
*/
|
||||
void
|
||||
pathcheck(name)
|
||||
char *name;
|
||||
pathcheck(char *name)
|
||||
{
|
||||
char *cp;
|
||||
struct entry *ep;
|
||||
@ -87,8 +86,7 @@ pathcheck(name)
|
||||
* Change a name to a unique temporary name.
|
||||
*/
|
||||
void
|
||||
mktempname(ep)
|
||||
struct entry *ep;
|
||||
mktempname(struct entry *ep)
|
||||
{
|
||||
char oldname[MAXPATHLEN];
|
||||
|
||||
@ -106,8 +104,7 @@ mktempname(ep)
|
||||
* Generate a temporary name for an entry.
|
||||
*/
|
||||
char *
|
||||
gentempname(ep)
|
||||
struct entry *ep;
|
||||
gentempname(struct entry *ep)
|
||||
{
|
||||
static char name[MAXPATHLEN];
|
||||
struct entry *np;
|
||||
@ -126,8 +123,7 @@ gentempname(ep)
|
||||
* Rename a file or directory.
|
||||
*/
|
||||
void
|
||||
renameit(from, to)
|
||||
char *from, *to;
|
||||
renameit(char *from, char *to)
|
||||
{
|
||||
if (!Nflag && rename(from, to) < 0) {
|
||||
fprintf(stderr, "warning: cannot rename %s to %s: %s\n",
|
||||
@ -141,8 +137,7 @@ renameit(from, to)
|
||||
* Create a new node (directory).
|
||||
*/
|
||||
void
|
||||
newnode(np)
|
||||
struct entry *np;
|
||||
newnode(struct entry *np)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
@ -161,8 +156,7 @@ newnode(np)
|
||||
* Remove an old node (directory).
|
||||
*/
|
||||
void
|
||||
removenode(ep)
|
||||
struct entry *ep;
|
||||
removenode(struct entry *ep)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
@ -184,8 +178,7 @@ removenode(ep)
|
||||
* Remove a leaf.
|
||||
*/
|
||||
void
|
||||
removeleaf(ep)
|
||||
struct entry *ep;
|
||||
removeleaf(struct entry *ep)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
@ -205,9 +198,7 @@ removeleaf(ep)
|
||||
* Create a link.
|
||||
*/
|
||||
int
|
||||
linkit(existing, new, type)
|
||||
char *existing, *new;
|
||||
int type;
|
||||
linkit(char *existing, char *new, int type)
|
||||
{
|
||||
|
||||
/* if we want to unlink first, do it now so *link() won't fail */
|
||||
@ -256,8 +247,7 @@ linkit(existing, new, type)
|
||||
* Create a whiteout.
|
||||
*/
|
||||
int
|
||||
addwhiteout(name)
|
||||
char *name;
|
||||
addwhiteout(char *name)
|
||||
{
|
||||
|
||||
if (!Nflag && mknod(name, S_IFWHT, 0) < 0) {
|
||||
@ -273,8 +263,7 @@ addwhiteout(name)
|
||||
* Delete a whiteout.
|
||||
*/
|
||||
void
|
||||
delwhiteout(ep)
|
||||
struct entry *ep;
|
||||
delwhiteout(struct entry *ep)
|
||||
{
|
||||
char *name;
|
||||
|
||||
@ -295,8 +284,7 @@ delwhiteout(ep)
|
||||
* find lowest number file (above "start") that needs to be extracted
|
||||
*/
|
||||
ino_t
|
||||
lowerbnd(start)
|
||||
ino_t start;
|
||||
lowerbnd(ino_t start)
|
||||
{
|
||||
struct entry *ep;
|
||||
|
||||
@ -314,8 +302,7 @@ lowerbnd(start)
|
||||
* find highest number file (below "start") that needs to be extracted
|
||||
*/
|
||||
ino_t
|
||||
upperbnd(start)
|
||||
ino_t start;
|
||||
upperbnd(ino_t start)
|
||||
{
|
||||
struct entry *ep;
|
||||
|
||||
@ -333,9 +320,7 @@ upperbnd(start)
|
||||
* report on a badly formed entry
|
||||
*/
|
||||
void
|
||||
badentry(ep, msg)
|
||||
struct entry *ep;
|
||||
char *msg;
|
||||
badentry(struct entry *ep, char *msg)
|
||||
{
|
||||
|
||||
fprintf(stderr, "bad entry: %s\n", msg);
|
||||
@ -360,8 +345,7 @@ badentry(ep, msg)
|
||||
* Construct a string indicating the active flag bits of an entry.
|
||||
*/
|
||||
char *
|
||||
flagvalues(ep)
|
||||
struct entry *ep;
|
||||
flagvalues(struct entry *ep)
|
||||
{
|
||||
static char flagbuf[BUFSIZ];
|
||||
|
||||
@ -386,8 +370,7 @@ flagvalues(ep)
|
||||
* Check to see if a name is on a dump tape.
|
||||
*/
|
||||
ino_t
|
||||
dirlookup(name)
|
||||
const char *name;
|
||||
dirlookup(const char *name)
|
||||
{
|
||||
struct direct *dp;
|
||||
ino_t ino;
|
||||
@ -403,8 +386,7 @@ dirlookup(name)
|
||||
* Elicit a reply.
|
||||
*/
|
||||
int
|
||||
reply(question)
|
||||
char *question;
|
||||
reply(char *question)
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -424,28 +406,13 @@ reply(question)
|
||||
/*
|
||||
* handle unexpected inconsistencies
|
||||
*/
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
panic(const char *fmt, ...)
|
||||
#else
|
||||
panic(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
|
||||
vfprintf(stderr, fmt, ap);
|
||||
if (yflag)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user