#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.69 2002/01/31 10:49:17 stelian Exp $";
+ "$Id: main.c,v 1.74 2002/07/19 14:57:39 stelian Exp $";
#endif /* not lint */
#include <config.h>
#include <sys/time.h>
#include <time.h>
#ifdef __linux__
-#include <linux/fs.h>
#ifdef HAVE_EXT2FS_EXT2_FS_H
#include <ext2fs/ext2_fs.h>
#else
char *usedinomap; /* map of allocated inodes */
char *dumpdirmap; /* map of directories to be dumped */
char *dumpinomap; /* map of files to be dumped */
+char *metainomap; /* which of the inodes in dumpinomap will get
+ only their metadata dumped */
const char *disk; /* name of the disk file */
char tape[MAXPATHLEN];/* name of the tape file */
int bzipflag; /* compression is done using bzlib */
int Afile = 0; /* archive file descriptor */
int uflag; /* update flag */
+int mflag; /* dump metadata only if possible */
int Mflag; /* multi-volume flag */
int qflag; /* quit on errors flag */
+int vflag; /* verbose flag */
int breademax = 32; /* maximum number of bread errors before we quit */
char *eot_script; /* end of volume script fiag */
int diskfd; /* disk file descriptor */
#ifdef KERBEROS
"k"
#endif
- "Mnq"
+ "mMnq"
#ifdef USE_QFA
"Q:"
#endif
- "s:ST:uWw"
+ "s:ST:uvWw"
#ifdef HAVE_ZLIB
"z::"
#endif
}
break;
+ case 'm': /* metadata only flag */
+ mflag = 1;
+ break;
+
case 'M': /* multi-volume flag */
Mflag = 1;
break;
uflag = 1;
break;
+ case 'v': /* verbose */
+ vflag = 1;
+ break;
+
case 'W': /* what to do */
case 'w':
lastdump(ch);
if (TP_BSIZE != (1 << tp_bshift))
quit("TP_BSIZE (%d) is not a power of 2", TP_BSIZE);
maxino = fs->super->s_inodes_count + 1;
-#if 0
spcl.c_flags |= DR_NEWINODEFMT;
-#endif
#else /* __linux __*/
if ((diskfd = open(disk, O_RDONLY)) < 0) {
msg("Cannot open %s\n", disk);
usedinomap = (char *)calloc((unsigned) mapsize, sizeof(char));
dumpdirmap = (char *)calloc((unsigned) mapsize, sizeof(char));
dumpinomap = (char *)calloc((unsigned) mapsize, sizeof(char));
- if (usedinomap == NULL || dumpdirmap == NULL || dumpinomap == NULL)
+ metainomap = (char *)calloc((unsigned) mapsize, sizeof(char));
+ if (usedinomap == NULL || dumpdirmap == NULL ||
+ dumpinomap == NULL || metainomap == NULL)
quit("out of memory allocating inode maps\n");
tapesize = 2 * (howmany(mapsize * sizeof(char), TP_BSIZE) + 1);
/* print QFA-file header */
snprintf(gTps, sizeof(gTps), "%s\n%s\n%ld\n\n", QFA_MAGIC, QFA_VERSION, (unsigned long)spcl.c_date);
gTps[sizeof(gTps) - 1] = '\0';
- if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps))
+ if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps))
quit("can't write tapeposfile\n");
sprintf(gTps, "ino\ttapeno\ttapepos\n");
- if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps))
+ if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps))
quit("can't write tapeposfile\n");
}
#endif /* USE_QFA */
*/
if (dp->di_nlink == 0 || dp->di_dtime != 0)
continue;
+ if (vflag)
+ msg("dumping directory inode %lu\n", ino);
(void)dumpdirino(dp, ino);
#else
(void)dumpino(dp, ino);
* inodes since this is done in dumpino().
*/
#endif
- (void)dumpino(dp, ino);
+ if (vflag) {
+ if (mflag && TSTINO(ino, metainomap))
+ msg("dumping regular inode %lu (meta only)\n", ino);
+ else
+ msg("dumping regular inode %lu\n", ino);
+ }
+ (void)dumpino(dp, ino, mflag && TSTINO(ino, metainomap));
}
tend_writing = time(NULL);
#ifdef KERBEROS
"k"
#endif
- "MnqSu"
+ "mMnqSuv"
"] [-A file] [-B records] [-b blocksize]\n"
"\t%s [-d density] [-e inode#,inode#,...] [-E file] [-f file]\n"
"\t%s [-h level] [-I nr errors] "