Expand dump to allow MAX_INT dump levels.
PR: bin/100732 Submitted by: Matthew Vincenz <msvincen@midway.uchicago.edu>
This commit is contained in:
parent
fbc7e633a8
commit
e0c188cb54
@ -134,13 +134,4 @@ union u_spcl {
|
||||
#define TS_CLRI 6 /* map of inodes deleted since last dump */
|
||||
#define TS_END 5 /* end of volume marker */
|
||||
|
||||
/*
|
||||
* flag values
|
||||
*/
|
||||
/* None at the moment */
|
||||
|
||||
#define DUMPOUTFMT "%-32s %c %s" /* for printf */
|
||||
/* name, level, ctime(date) */
|
||||
#define DUMPINFMT "%32s %c %[^\n]\n" /* inverse for scanf */
|
||||
|
||||
#endif /* !_DUMPRESTORE_H_ */
|
||||
|
@ -59,8 +59,8 @@ 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 */
|
||||
char lastlevel; /* dump level of previous dump */
|
||||
char level; /* dump level of this dump */
|
||||
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 */
|
||||
@ -159,7 +159,7 @@ struct fstab *fstabsearch(const char *key); /* search fs_file and fs_spec */
|
||||
*/
|
||||
struct dumpdates {
|
||||
char dd_name[NAME_MAX+3];
|
||||
char dd_level;
|
||||
int dd_level;
|
||||
time_t dd_ddate;
|
||||
};
|
||||
int nddates; /* number of records (might be zero) */
|
||||
@ -171,6 +171,10 @@ void putdumptime(void);
|
||||
if (ddatev != NULL) \
|
||||
for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
|
||||
|
||||
#define DUMPOUTFMT "%-32s %d %s" /* for printf */
|
||||
/* name, level, ctime(date) */
|
||||
#define DUMPINFMT "%32s %d %[^\n]\n" /* inverse for scanf */
|
||||
|
||||
void sig(int signo);
|
||||
|
||||
#ifndef _PATH_FSTAB
|
||||
|
@ -132,11 +132,11 @@ getdumptime(void)
|
||||
|
||||
fname = disk;
|
||||
#ifdef FDEBUG
|
||||
msg("Looking for name %s in dumpdates = %s for level = %c\n",
|
||||
msg("Looking for name %s in dumpdates = %s for level = %d\n",
|
||||
fname, dumpdates, level);
|
||||
#endif
|
||||
spcl.c_ddate = 0;
|
||||
lastlevel = '0';
|
||||
lastlevel = 0;
|
||||
|
||||
initdumptimes();
|
||||
/*
|
||||
@ -213,7 +213,7 @@ putdumptime(void)
|
||||
time_t t = _time64_to_time(spcl.c_date);
|
||||
tmsg = ctime(&t);
|
||||
}
|
||||
msg("level %c dump on %s", level, tmsg);
|
||||
msg("level %d dump on %s", level, tmsg);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -241,7 +241,7 @@ getrecord(FILE *df, struct dumpdates *ddatep)
|
||||
dumpdates, recno);
|
||||
|
||||
#ifdef FDEBUG
|
||||
msg("getrecord: %s %c %s", ddatep->dd_name, ddatep->dd_level,
|
||||
msg("getrecord: %s %d %s", ddatep->dd_name, ddatep->dd_level,
|
||||
ddatep->dd_ddate == 0 ? "the epoch\n" : ctime(&ddatep->dd_ddate));
|
||||
#endif
|
||||
return(0);
|
||||
|
@ -116,7 +116,7 @@ main(int argc, char *argv[])
|
||||
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';
|
||||
level = 0;
|
||||
rsync_friendly = 0;
|
||||
|
||||
if (argc < 2)
|
||||
@ -129,7 +129,7 @@ main(int argc, char *argv[])
|
||||
/* dump level */
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
level = ch;
|
||||
level = 10 * level + ch - '0';
|
||||
break;
|
||||
|
||||
case 'a': /* `auto-size', Write to EOM. */
|
||||
@ -216,7 +216,7 @@ main(int argc, char *argv[])
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
Tflag = 1;
|
||||
lastlevel = '?';
|
||||
lastlevel = -1;
|
||||
break;
|
||||
|
||||
case 'u': /* update /etc/dumpdates */
|
||||
@ -247,7 +247,7 @@ main(int argc, char *argv[])
|
||||
(void)fprintf(stderr, "\n");
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
if (rsync_friendly && (level>'0')) {
|
||||
if (rsync_friendly && (level > 0)) {
|
||||
(void)fprintf(stderr, "%s %s\n", "rsync friendly options",
|
||||
"can be used only with level 0 dumps.");
|
||||
exit(X_STARTUP);
|
||||
@ -398,7 +398,7 @@ main(int argc, char *argv[])
|
||||
|
||||
(void)strcpy(spcl.c_label, "none");
|
||||
(void)gethostname(spcl.c_host, NAMELEN);
|
||||
spcl.c_level = level - '0';
|
||||
spcl.c_level = level;
|
||||
spcl.c_type = TS_TAPE;
|
||||
if (rsync_friendly) {
|
||||
/* don't store real dump times */
|
||||
@ -411,7 +411,7 @@ main(int argc, char *argv[])
|
||||
time_t t = _time64_to_time(spcl.c_date);
|
||||
tmsg = ctime(&t);
|
||||
}
|
||||
msg("Date of this level %c dump: %s", level, tmsg);
|
||||
msg("Date of this level %d dump: %s", level, tmsg);
|
||||
|
||||
if (!Tflag && (!rsync_friendly))
|
||||
getdumptime(); /* /etc/dumpdates snarfed */
|
||||
@ -421,7 +421,10 @@ main(int argc, char *argv[])
|
||||
time_t t = _time64_to_time(spcl.c_ddate);
|
||||
tmsg = ctime(&t);
|
||||
}
|
||||
msg("Date of last level %c dump: %s", lastlevel, tmsg);
|
||||
if (lastlevel < 0)
|
||||
msg("Date of last (level unknown) dump: %s", tmsg);
|
||||
else
|
||||
msg("Date of last level %d dump: %s", lastlevel, tmsg);
|
||||
|
||||
msg("Dumping %s%s ", snapdump ? "snapshot of ": "", disk);
|
||||
if (dt != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user