* Remy Card <card@Linux.EU.Org>, 1994-1997
* Stelian Pop <pop@cybercable.fr>, 1999
*
- * $Id: dump.h,v 1.7 1999/11/21 02:24:47 tiniou Exp $
+ * $Id: dump.h,v 1.8 1999/11/21 16:01:47 tiniou Exp $
*/
/*-
#define MAXINOPB (MAXBSIZE / sizeof(struct dinode))
#define MAXNINDIR (MAXBSIZE / sizeof(daddr_t))
+#ifndef NAME_MAX
+#define NAME_MAX 255
+#endif
+
/*
* Dump maps used to describe what is to be dumped.
*/
* All calculations done in 0.1" units!
*/
char *disk; /* name of the disk file */
-char *tape; /* name of the tape file */
+char tape[NAME_MAX]; /* name of the tape file */
+char *tapeprefix; /* prefix of the tape file */
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 uflag; /* update flag */
+int Mflag; /* multi-volume flag */
int diskfd; /* disk file descriptor */
int tapefd; /* tape file descriptor */
int pipeout; /* true => output to standard output */
struct fstab *fstabsearchdir __P((const char *key, char *dir)); /* search fs_file and fs_spec */
#endif
-#ifndef NAME_MAX
-#define NAME_MAX 255
-#endif
-
/*
* The contents of the file _PATH_DUMPDATES is maintained both on
* a linked list, and then (eventually) arrayified.
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.7 1999/11/21 02:24:47 tiniou Exp $";
+ "$Id: main.c,v 1.8 1999/11/21 16:01:47 tiniou Exp $";
#endif /* not lint */
#include <sys/param.h>
#endif
tsize = 0; /* Default later, based on 'c' option for cart tapes */
- if ((tape = getenv("TAPE")) == NULL)
- tape = _PATH_DEFTAPE;
+ if ((tapeprefix = getenv("TAPE")) == NULL)
+ tapeprefix = _PATH_DEFTAPE;
dumpdates = _PATH_DUMPDATES;
temp = _PATH_DTMP;
strcpy(labelstr, "none"); /* XXX safe strcpy. */
obsolete(&argc, &argv);
#ifdef KERBEROS
-#define optstring "0123456789aB:b:cd:f:h:kL:ns:T:uWw"
+#define optstring "0123456789aB:b:cd:f:h:kL:Mns:T:uWw"
#else
-#define optstring "0123456789aB:b:cd:f:h:L:ns:T:uWw"
+#define optstring "0123456789aB:b:cd:f:h:L:Mns:T:uWw"
#endif
while ((ch = getopt(argc, argv, optstring)) != -1)
#undef optstring
break;
case 'f': /* output file */
- tape = optarg;
+ tapeprefix = optarg;
break;
case 'h':
}
break;
+ case 'M': /* multi-volume flag */
+ Mflag = 1;
+ break;
+
case 'n': /* notify operators */
notify = 1;
break;
"You cannot use the T and u flags together.\n");
exit(X_STARTUP);
}
- if (strcmp(tape, "-") == 0) {
+ if (strcmp(tapeprefix, "-") == 0) {
pipeout++;
- tape = "standard output";
+ tapeprefix = "standard output";
}
if (blocksperfile)
tsize = cartridge ? 1700L*120L : 2300L*120L;
}
- if (strchr(tape, ':')) {
- host = tape;
- tape = strchr(host, ':');
- *tape++ = '\0';
+ if (strchr(tapeprefix, ':')) {
+ host = tapeprefix;
+ tapeprefix = strchr(host, ':');
+ *tapeprefix++ = '\0';
#ifdef RDUMP
- if (index(tape, '\n')) {
+ if (index(tapeprefix, '\n')) {
(void)fprintf(stderr, "invalid characters in tape\n");
exit(X_STARTUP);
}
spcl.c_level = 0;
}
+ if (Mflag)
+ snprintf(tape, NAME_MAX, "%s%03d", tapeprefix, tapeno + 1);
+ else
+ strncpy(tape, tapeprefix, NAME_MAX);
+ tape[NAME_MAX - 1] = '\0';
+
msg("Date of this level %c dump: %s", level,
#ifdef __linux__
spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date));
#ifdef KERBEROS
"k"
#endif
- "nu] [-B records] [-b blocksize] [-d density]\n"
+ "Mnu] [-B records] [-b blocksize] [-d density]\n"
"\t%s [-f file] [-h level] [-s feet] [-T date] filesystem\n"
"\t%s [-W | -w]\n", __progname, white, __progname);
exit(X_STARTUP);
#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.8 1999/11/21 02:24:47 tiniou Exp $";
+ "$Id: tape.c,v 1.9 1999/11/21 16:01:47 tiniou Exp $";
#endif /* not lint */
#ifdef __linux__
{
trewind();
(void)do_stats();
- if (nexttape)
+ if (nexttape || Mflag)
return;
if (!nogripe) {
msg("Change Volumes: Mount volume #%d\n", tapeno+1);
* the remaining names for subsequent volumes.
*/
tapeno++; /* current tape sequence */
- if (nexttape || strchr(tape, ',')) {
+ if (Mflag) {
+ snprintf(tape, NAME_MAX, "%s%03d", tapeprefix, tapeno);
+ tape[NAME_MAX - 1] = '\0';
+ msg("Dumping volume %d on %s\n", tapeno, tape);
+ }
+ else if (nexttape || strchr(tapeprefix, ',')) {
if (nexttape && *nexttape)
- tape = nexttape;
- if ((p = strchr(tape, ',')) != NULL) {
+ tapeprefix = nexttape;
+ if ((p = strchr(tapeprefix, ',')) != NULL) {
*p = '\0';
nexttape = p + 1;
} else
nexttape = NULL;
+ strncpy(tape, tapeprefix, NAME_MAX);
+ tape[NAME_MAX - 1] = '\0';
msg("Dumping volume %d on %s\n", tapeno, tape);
}
#ifdef RDUMP