-$Id: CHANGES,v 1.245 2004/04/13 13:03:55 stelian Exp $
+$Id: CHANGES,v 1.246 2004/04/21 08:56:24 stelian Exp $
Changes between versions 0.4b35 and 0.4b36 (released ?????????????????)
=======================================================================
David <vrtin@users.sourceforge.net> for submitting the bug
and providing a test case.
+11. Made dump work with an arbitrary integer level (no more 10
+ levels only limitation). Thanks to Matthew
+ <msvincen@midway.uchicago.edu> for the patch.
+
Changes between versions 0.4b34 and 0.4b35 (released December 21, 2003)
=======================================================================
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dump.8.in,v 1.55 2004/02/18 16:26:41 stelian Exp $
+.\" $Id: dump.8.in,v 1.56 2004/04/21 08:55:48 stelian Exp $
.\"
.TH DUMP 8 "version __VERSION__ of __DATE__" BSD "System management commands"
.SH NAME
dump \- ext2/3 filesystem backup
.SH SYNOPSIS
.B dump
-[\fB\-0123456789ackMnqSuv\fR]
+[\fB\-\fIlevel#\fR]
+[\fB\-ackMnqSuv]
[\fB\-A \fIfile\fR]
[\fB\-B \fIrecords\fR]
[\fB\-b \fIblocksize\fR]
The following options are supported by
.B dump:
.TP
-.BI \-0\-9
-Dump levels. A level 0, full backup, guarantees the entire file system is
-copied (but see also the
+.BI \-level#
+The dump level (any integer). A level 0, full backup, guarantees the
+entire file system is copied (but see also the
.B \-h
option below). A level number above 0, incremental backup, tells
.B dump
to
copy all files new or modified since the last dump of a lower level. The
-default level is 9.
+default level is 9. Historically only levels 0 to 9 were usable in
+dump, this version is able to understand any integer as a dump level.
.TP
.BI \-a
\*(lqauto-size\*(rq. Bypass all tape length calculations, and write until an
* Stelian Pop <stelian@popies.net>, 1999-2000
* Stelian Pop <stelian@popies.net> - AlcĂ´ve <www.alcove.com>, 2000-2002
*
- * $Id: dump.h,v 1.47 2003/10/26 16:05:46 stelian Exp $
+ * $Id: dump.h,v 1.48 2004/04/21 08:55:51 stelian Exp $
*/
/*-
#define MAXINOPB (MAXBSIZE / sizeof(struct dinode))
#define MAXNINDIR (MAXBSIZE / sizeof(daddr_t))
+#define NUM_STR_SIZE 32 /* a generic number buffer size */
/*
* Dump maps used to describe what is to be dumped.
extern char tape[MAXPATHLEN];/* name of the tape file */
extern char *tapeprefix; /* prefix of the tape file */
extern char *dumpdates; /* name of the file containing dump date information*/
-extern char lastlevel; /* dump level of previous dump */
-extern char level; /* dump level of this dump */
+extern char lastlevel[NUM_STR_SIZE];/* dump level of previous dump */
+extern char level[NUM_STR_SIZE];/* dump level of this dump */
extern int Afile; /* archive file descriptor */
extern int AfileActive; /* Afile flag */
extern int zipflag; /* which compression method */
struct dumpdates {
char dd_name[MAXPATHLEN+3];
struct mntent *dd_fstab;
- char dd_level;
+ int dd_level;
time_t dd_ddate;
};
struct dumptime {
#ifndef lint
static const char rcsid[] =
- "$Id: itime.c,v 1.26 2003/10/26 16:05:47 stelian Exp $";
+ "$Id: itime.c,v 1.27 2004/04/21 08:55:51 stelian Exp $";
#endif /* not lint */
#include <config.h>
int i;
#ifdef FDEBUG
- msg("Looking for name %s in dumpdates = %s for level = %c\n",
+ msg("Looking for name %s in dumpdates = %s for level = %s\n",
disk, dumpdates, level);
#endif
spcl.c_ddate = 0;
- lastlevel = '0';
+ memset(&lastlevel, 0, NUM_STR_SIZE);
/* If this is a level 0 dump, and we're not updating
dumpdates, there's no point in trying to read
dumpdates. It may not exist yet, or may not be mounted. For
incrementals, we *must* read dumpdates (fail if it's not there!) */
- if ( (level == lastlevel) && !createdumpdates)
+ if ( (!strcmp(level, lastlevel)) && !createdumpdates)
return;
initdumptimes(createdumpdates);
if (ddatev == NULL)
ITITERATE(i, ddp) {
if (strncmp(disk, ddp->dd_name, sizeof (ddp->dd_name)) != 0)
continue;
- if (ddp->dd_level >= level)
+ if (ddp->dd_level >= atoi(level))
continue;
if (ddp->dd_ddate <= (time_t)spcl.c_ddate)
continue;
spcl.c_ddate = ddp->dd_ddate;
- lastlevel = ddp->dd_level;
+ snprintf(lastlevel, NUM_STR_SIZE, "%d", ddp->dd_level);
}
}
if (strncmp(disk, dtwalk->dd_name,
sizeof (dtwalk->dd_name)) != 0)
continue;
- if (dtwalk->dd_level != level)
+ if (dtwalk->dd_level != atoi(level))
continue;
goto found;
}
nddates += 1;
found:
(void) strncpy(dtwalk->dd_name, disk, sizeof (dtwalk->dd_name));
- dtwalk->dd_level = level;
+ dtwalk->dd_level = atoi(level);
dtwalk->dd_ddate = spcl.c_date;
ITITERATE(i, dtwalk) {
if (buf[24] != '\n' || buf[25] != '\0')
quit("asctime returned an unexpected string\n");
buf[24] = 0;
- if (fprintf(file, "%s %c %s %c%2.2d%2.2d\n",
+ if (fprintf(file, "%s %d %s %c%2.2d%2.2d\n",
what->dd_name,
what->dd_level,
buf,
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);
makedumpdate(struct dumpdates *ddp, char *tbuf)
{
char *tok;
-
/* device name */
if ( NULL == (tok = strsep( &tbuf, " ")) )
return(-1);
for( ; *tbuf == ' ' ; tbuf++);
/* dump level */
- ddp->dd_level = *tbuf;
- ++tbuf;
+ ddp->dd_level = atoi(tbuf);
+ /* eat the rest of the numbers*/
+ for( ; *tbuf >= '0' && *tbuf <= '9' ; tbuf++);
/* eat whitespace */
for( ; *tbuf == ' ' ; tbuf++);
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.91 2004/01/27 10:46:55 stelian Exp $";
+ "$Id: main.c,v 1.92 2004/04/21 08:55:51 stelian Exp $";
#endif /* not lint */
#include <config.h>
char tape[MAXPATHLEN];/* name of the tape file */
char *tapeprefix; /* prefix of the tape file */
char *dumpdates; /* name of the file containing dump date information*/
-char lastlevel; /* dump level of previous dump */
-char level; /* dump level of this dump */
+char lastlevel[NUM_STR_SIZE];/* dump level of previous dump */
+char level[NUM_STR_SIZE];/* dump level of this dump */
int zipflag; /* which compression method */
int Afile = -1; /* archive file descriptor */
int AfileActive = 1;/* Afile flag */
struct dinode *dp;
struct mntent *dt;
char *map;
- int ch;
+ int ch, pch = 0;
int i, anydirskipped;
int aflag = 0, bflag = 0, Tflag = 0, honorlevel = 1;
dump_ino_t maxino;
dumpdates = _PATH_DUMPDATES;
if (TP_BSIZE / DEV_BSIZE == 0 || TP_BSIZE % DEV_BSIZE != 0)
quit("TP_BSIZE must be a multiple of DEV_BSIZE\n");
- level = '0';
+ memset(&lastlevel, 0, NUM_STR_SIZE);
+ memset(&level, 0, NUM_STR_SIZE);
if (argc < 2)
usage();
/* dump level */
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
- level = ch;
+ if ((pch >= '0') && (pch <= '9') && (strlen(level) < NUM_STR_SIZE))
+ level[strlen(level)] = ch;
+ else
+ level[0] = ch;
+ pch = ch;
break;
case 'A': /* archive file */
exit(X_STARTUP);
}
Tflag = 1;
- lastlevel = '?';
+ lastlevel[0] = '?'; lastlevel[1] = '\0';
break;
case 'u': /* update dumpdates */
}
if (directory[0] != 0) {
- if (level != '0') {
+ if (atoi(level) != 0) {
msg("Only level 0 dumps are allowed on a subdirectory\n");
msg("The ENTIRE dump is aborted.\n");
exit(X_STARTUP);
spcl.c_filesys[NAMELEN-1] = '\0';
(void)gethostname(spcl.c_host, NAMELEN);
spcl.c_host[NAMELEN-1] = '\0';
- spcl.c_level = level - '0';
+ spcl.c_level = atoi(level);
spcl.c_type = TS_TAPE;
if (!Tflag)
getdumptime(uflag); /* dumpdates snarfed */
if (spcl.c_ddate == 0 && spcl.c_level) {
msg("WARNING: There is no inferior level dump on this filesystem\n");
msg("WARNING: Assuming a level 0 dump by default\n");
- level = '0';
+ level[0] = '0'; level[1] = '\0';
spcl.c_level = 0;
}
if (!sizest) {
- msg("Date of this level %c dump: %s", level,
+ msg("Date of this level %s dump: %s", level,
ctime4(&spcl.c_date));
#ifdef USE_QFA
gThisDumpDate = spcl.c_date;
#endif
if (spcl.c_ddate)
- msg("Date of last level %c dump: %s", lastlevel,
+ msg("Date of last level %s dump: %s", lastlevel,
ctime4(&spcl.c_ddate));
msg("Dumping %s (%s) ", disk, spcl.c_filesys);
if (host)
spcl.c_tapea / (tend_writing - tstart_writing));
putdumptime();
- msg("Date of this level %c dump: %s", level,
+ msg("Date of this level %s dump: %s", level,
spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date));
msg("Date this dump completed: %s", ctime(&tnow));
fprintf(stderr, "%s %s\n", __progname, _DUMP_VERSION);
#endif
fprintf(stderr,
- "usage:\t%s [-0123456789ac"
+ "usage:\t%s [-level#] [-ac"
#ifdef KERBEROS
"k"
#endif
#ifndef lint
static const char rcsid[] =
- "$Id: optr.c,v 1.37 2003/04/10 07:59:05 stelian Exp $";
+ "$Id: optr.c,v 1.38 2004/04/21 08:55:51 stelian Exp $";
#endif /* not lint */
#include <config.h>
date = (char *)ctime(&ddate);
d = strchr(date, '\n');
if (d) *d = '\0';
- printf("Level %c, Date %s\n", level, date);
+ printf("Level %d, Date %s\n", level, date);
} else
printf("never\n");
}