-$Id: CHANGES,v 1.106 2001/03/19 13:22:48 stelian Exp $
+$Id: CHANGES,v 1.107 2001/03/20 09:14:57 stelian Exp $
Changes between versions 0.4b21 and 0.4b22 (released ????????????????)
======================================================================
it upstream.
5. Many cleanups (CPP defines, const char warnings, check of
- ext2fs COMPAT flags) by Andreas Dilger <adilger@turbolinux.com>.
+ ext2fs COMPAT flags, time_t cleanups, added libext2 version
+ in dump usage text) by Andreas Dilger <adilger@turbolinux.com>.
Changes between versions 0.4b20 and 0.4b21 (released January 13, 2001)
======================================================================
* Stelian Pop <pop@noos.fr>, 1999-2000
* Stelian Pop <pop@noos.fr> - AlcĂ´ve <www.alcove.fr>, 2000
*
- * $Id: bsdcompat.h,v 1.13 2000/12/21 11:14:53 stelian Exp $
+ * $Id: bsdcompat.h,v 1.14 2001/03/20 09:14:58 stelian Exp $
*/
#include <config.h>
/*
* The BSD dump format reserves 4 bytes for a time_t, but other architectures
* (notably axp) have larger time_t. ctime4() is a modified ctime() which
- * always accepts short 4-byte times. time4() is a similarly modified time().
+ * always accepts short 4-byte times.
*/
#define ctime4(timep) ({ time_t t = *(timep); ctime(&t); })
-#define time4(timep) ({time_t t; t = time(0); if (timep) *timep=t; t; })
/*
* This is the ext2_inode structure but the fields have been renamed
#ifndef lint
static const char rcsid[] =
- "$Id: itime.c,v 1.16 2001/03/19 13:22:48 stelian Exp $";
+ "$Id: itime.c,v 1.17 2001/03/20 09:14:58 stelian Exp $";
#endif /* not lint */
#include <config.h>
continue;
if (ddp->dd_level >= level)
continue;
-#ifdef __linux__
if (ddp->dd_ddate <= (time_t)spcl.c_ddate)
-#else
- if (ddp->dd_ddate <= spcl.c_ddate)
-#endif
continue;
spcl.c_ddate = ddp->dd_ddate;
lastlevel = ddp->dd_level;
quit("ftruncate (%s): %s\n", dumpdates, strerror(errno));
(void) fclose(df);
msg("level %c dump on %s", level,
-#ifdef __linux__
spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date));
-#else
- spcl.c_date == 0 ? "the epoch\n" : ctime(&spcl.c_date));
-#endif
}
static void
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.35 2001/03/19 13:22:48 stelian Exp $";
+ "$Id: main.c,v 1.36 2001/03/20 09:14:58 stelian Exp $";
#endif /* not lint */
#include <config.h>
char *diskparam;
spcl.c_label[0] = '\0';
- spcl.c_date = 0;
-#ifdef __linux__
- (void)time4(&spcl.c_date);
-#else
- (void)time((time_t *)&spcl.c_date);
-#endif
+ spcl.c_date = time(NULL);
#ifdef __linux__
__progname = argv[0];
if (!sizest) {
msg("Date of this level %c dump: %s", level,
-#ifdef __linux__
- spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date));
-#else
- spcl.c_date == 0 ? "the epoch\n" : ctime(&spcl.c_date));
-#endif
- msg("Date of last level %c dump: %s", lastlevel,
-#ifdef __linux__
- spcl.c_ddate == 0 ? "the epoch\n" : ctime4(&spcl.c_ddate));
-#else
- spcl.c_ddate == 0 ? "the epoch\n" : ctime(&spcl.c_ddate));
-#endif
+ ctime4(&spcl.c_date));
+ if (spcl.c_ddate)
+ msg("Date of last level %c dump: %s", lastlevel,
+ ctime4(&spcl.c_ddate));
msg("Dumping %s (%s) ", disk, spcl.c_filesys);
if (host)
msgtail("to %s on host %s\n", tape, host);
"can't allocate tape buffers - try a smaller blocking factor.\n");
startnewtape(1);
-#ifdef __linux__
- (void)time4(&(tstart_writing));
-#else
- (void)time((time_t *)&(tstart_writing));
-#endif
+ tstart_writing = time(NULL);
dumpmap(usedinomap, TS_CLRI, maxino - 1);
msg("dumping (Pass III) [directories]\n");
(void)dumpino(dp, ino);
}
-#ifdef __linux__
- (void)time4(&(tend_writing));
-#else
- (void)time((time_t *)&(tend_writing));
-#endif
+ tend_writing = time(NULL);
spcl.c_type = TS_END;
for (i = 0; i < ntrec; i++)
writeheader(maxino - 1);
spcl.c_tapea / (tend_writing - tstart_writing));
putdumptime();
-#ifdef __linux__
msg("Date of this level %c dump: %s", level,
spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date));
-#else
- msg("Date of this level %c dump: %s", level,
- spcl.c_date == 0 ? "the epoch\n" : ctime(&spcl.c_date));
-#endif
msg("Date this dump completed: %s", ctime(&tnow));
msg("Average transfer rate: %ld KB/s\n", xferrate / tapeno);
usage(void)
{
char white[MAXPATHLEN];
- int i;
-
- strncpy(white, __progname, MAXPATHLEN-1);
- white[MAXPATHLEN-1] = '\0';
- for (i=0; i<MAXPATHLEN; ++i)
- if (white[i] != '\0') white[i] = ' ';
+ const char *ext2ver, *ext2date;
- fprintf(stderr,
- "%s %s\n", __progname, _DUMP_VERSION);
+ memset(white, ' ', MAXPATHLEN);
+ white[MIN(strlen(__progname), MAXPATHLEN - 1)] = '\0';
+
+#ifdef __linux__
+ ext2fs_get_library_version(&ext2ver, &ext2date);
+ fprintf(stderr, "%s %s (using libext2fs %s of %s)\n",
+ __progname, _DUMP_VERSION, ext2ver, ext2date);
+#else
+ fprintf(stderr, "%s %s\n", __progname, _DUMP_VERSION);
+#endif
fprintf(stderr,
"usage:\t%s [-0123456789ac"
#ifdef KERBEROS
#ifndef lint
static const char rcsid[] =
- "$Id: optr.c,v 1.21 2001/03/19 13:22:48 stelian Exp $";
+ "$Id: optr.c,v 1.22 2001/03/20 09:14:58 stelian Exp $";
#endif /* not lint */
#include <config.h>
FILE *mytty;
time_t firstprompt, when_answered;
-#ifdef __linux__
- (void)time4(&(firstprompt));
-#else
- (void)time((time_t *)&(firstprompt));
-#endif
+ firstprompt = time(NULL);
if ((mytty = fopen(_PATH_TTY, "r")) == NULL)
quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno));
if (signal(SIGALRM, sig) == SIG_IGN)
signal(SIGALRM, SIG_IGN);
(void) fclose(mytty);
-#ifdef __linux__
- (void)time4(&(when_answered));
-#else
- (void)time((time_t *)&(when_answered));
-#endif
+ when_answered = time(NULL);
/*
* Adjust the base for time estimates to ignore time we spent waiting
* for operator input.
*/
- if ((tstart_writing != 0) && (when_answered != (time_t)-1) && (firstprompt != (time_t)-1))
+ if (tstart_writing != 0)
tstart_writing += (when_answered - firstprompt);
return(back);
}
return;
}
- clock = time((time_t *)0);
+ clock = time(NULL);
localclock = localtime(&clock);
if ((f_utmp = fopen(_PATH_UTMP, "r")) == NULL) {
void
timeest(void)
{
- time_t tnow;
+ time_t tnow = time(NULL);
-#ifdef __linux__
- (void) time4(&tnow);
-#else
- (void) time((time_t *) &tnow);
-#endif
if (tnow >= tschedule) {
char *buf = mktimeest(tnow);
tschedule = tnow + 300;
struct pfstab *pf;
time_t tnow;
- (void) time(&tnow);
+ tnow = time(NULL);
getfstab(); /* /etc/fstab input */
initdumptimes(0); /* dumpdates input */
if (ddatev == NULL && table == NULL) {
#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.34 2001/03/19 13:22:48 stelian Exp $";
+ "$Id: tape.c,v 1.35 2001/03/20 09:14:58 stelian Exp $";
#endif /* not lint */
#include <config.h>
time_t tnow, ttaken;
int blocks;
-#ifdef __linux__
- (void)time4(&tnow);
-#else
- (void)time(&tnow);
-#endif
+ tnow = time(NULL);
ttaken = tnow - tstart_volume;
blocks = spcl.c_tapea - tapea_volume;
- msg("Volume %d completed at: %s", tapeno,
-#ifdef __linux__
- ctime4(&tnow));
-#else
- ctime(&tnow));
-#endif
+ msg("Volume %d completed at: %s", tapeno, ctime(&tnow));
if (! compressed)
msg("Volume %d %ld tape blocks (%.2fMB)\n", tapeno,
blocks, ((double)blocks * TP_BSIZE / 1048576));
void
statussig(int notused)
{
- time_t tnow;
int save_errno = errno;
char *buf;
-#ifdef __linux__
- (void) time4(&tnow);
-#else
- (void) time((time_t *) &tnow);
-#endif
- buf = mktimeest(tnow);
+ buf = mktimeest(time(NULL));
if (buf)
write(STDERR_FILENO, buf, strlen(buf));
errno = save_errno;
uncomprblks++;
slp->sent = 0;
- /* Check for errors */
- if (got < 0)
- tperror(-got);
-
- /* Check for end of tape */
- if (got == 0) {
- msg("End of tape detected\n");
+ /* Check for errors or end of tape */
+ if (got <= 0) {
+ /* Check for errors */
+ if (got < 0)
+ tperror(-got);
+ else
+ msg("End of tape detected\n");
/*
* Drain the results, don't care what the values were.
parentpid = getpid();
tapea_volume = spcl.c_tapea;
tapea_bytes = bytes_written;
-#ifdef __linux__
- (void)time4(&tstart_volume);
-#else
- (void)time((&tstart_volume);
-#endif
+ tstart_volume = time(NULL);
restore_check_point:
#ifdef __linux__
spcl.c_flags |= DR_COMPRESSED;
writeheader((ino_t)slp->inode);
spcl.c_flags &=~ DR_NEWHEADER;
- msg("Volume %d started at: %s", tapeno,
-#ifdef __linux__
- ctime4(&tstart_volume));
-#else
- ctime(&tstart_volume));
-#endif
+ msg("Volume %d started with block %ld at: %s", tapeno,
+ spcl.c_tapea, ctime(&tstart_volume));
if (tapeno > 1)
msg("Volume %d begins with blocks from inode %d\n",
tapeno, slp->inode);
#ifndef lint
static const char rcsid[] =
- "$Id: traverse.c,v 1.26 2001/03/19 13:22:49 stelian Exp $";
+ "$Id: traverse.c,v 1.27 2001/03/20 09:14:58 stelian Exp $";
#endif /* not lint */
#include <config.h>
extern int iexclude_num; /* number of elements in list */
/* Temporary fix waiting for Andreas fixes... */
-#define ext2_ino_t ino_t
-#undef EXT3_FEATURE_INCOMPAT_RECOVER
+#ifdef HAS_EXT2FS_EXT2_FS
+#define ext2_journal_ino(sb) (sb->s_journal_inum)
+#else
+#define ext2_ino_t __u32
+#define ext2_journal_ino(sb) (*((__u32 *)sb + 0x38))
+#endif
#ifndef EXT3_FEATURE_COMPAT_HAS_JOURNAL
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
#endif
#ifndef EXT3_FEATURE_INCOMPAT_RECOVER
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
-#define FORCE_OPEN EXT2_FLAG_FORCE
-#define ext2_journal_ino(sb) (*((__u32 *)sb + 0x38))
-#else
-#define FORCE_OPEN 0
-#define ext2_journal_ino(sb) (sb->s_journal_inum)
#endif
#ifndef EXT3_FEATURE_INCOMPAT_JOURNAL_DEV
-#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
+#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
#endif
#ifndef EXT2_LIB_FEATURE_INCOMPAT_SUPP
{
int retval;
- retval = ext2fs_open(disk, FORCE_OPEN, 0, 0, unix_io_manager, fs);
+ retval = ext2fs_open(disk, EXT2_FLAG_FORCE, 0, 0, unix_io_manager, fs);
if (!retval) {
struct ext2_super_block *es = (*fs)->super;
ext2_ino_t journal_ino = ext2_journal_ino(es);
+
if (es->s_feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV){
fprintf(stderr, "This an journal, not a filesystem!\n");
retval = EXT2_ET_UNSUPP_FEATURE;
ext2fs_close(*fs);
}
else if (es->s_feature_compat &
- EXT3_FEATURE_COMPAT_HAS_JOURNAL && journal_ino &&
- !exclude_ino(journal_ino)) {
+ EXT3_FEATURE_COMPAT_HAS_JOURNAL &&
+ journal_ino && !exclude_ino(journal_ino)) {
iexclude_list[iexclude_num++] = journal_ino;
msg("Added ext3 journal inode %d to exclude list\n",
- journal_ino);
+ journal_ino);
}
}
return retval;
int
mapfiles(ino_t maxino, long *tapesize)
{
- ino_t ino;
+ ext2_ino_t ino;
int anydirskipped = 0;
ext2_inode_scan scan;
errcode_t err;
register int mode;
errcode_t retval;
struct mapfile_context *mfc;
- ino_t ino;
+ ext2_ino_t ino;
ino = dirent->inode;
mfc = (struct mapfile_context *)private;
{
errcode_t retval;
struct mapfile_context mfc;
- ino_t dir_ino;
+ ext2_ino_t dir_ino;
char dir_name [MAXPATHLEN];
int i, anydirskipped = 0;
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.16 2001/02/21 16:13:05 stelian Exp $";
+ "$Id: main.c,v 1.17 2001/03/20 09:14:58 stelian Exp $";
#endif /* not lint */
#include <config.h>
static void
usage(void)
{
+#ifdef __linux__
+ const char *ext2ver, *ext2date;
+
+ ext2fs_get_library_version(&ext2ver, &ext2date);
+ (void)fprintf(stderr, "%s %s (using libext2fs %s of %s)\n",
+ __progname, _DUMP_VERSION, ext2ver, ext2date);
+#else
+ (void)fprintf(stderr, "%s %s\n", __progname, _DUMP_VERSION);
+#endif
+
#ifdef KERBEROS
#define kerbflag "k"
#else
#define kerbflag
#endif
- (void)fprintf(stderr,
- "%s %s\n", __progname, _DUMP_VERSION);
(void)fprintf(stderr,
"usage:\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n",
__progname, " -i [-ch" kerbflag "mMuvy] [-b blocksize] [-f file] [-s fileno]",
#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.27 2001/03/19 13:22:49 stelian Exp $";
+ "$Id: tape.c,v 1.28 2001/03/20 09:14:58 stelian Exp $";
#endif /* not lint */
#include <config.h>
goto again;
}
if (tmpbuf.c_date != dumpdate || tmpbuf.c_ddate != dumptime) {
-#ifdef __linux__
fprintf(stderr, "Wrong dump date\n\tgot: %s",
ctime4(&tmpbuf.c_date));
- fprintf(stderr, "\twanted: %s", ctime4(&dumpdate));
-#else
- fprintf(stderr, "Wrong dump date\n\tgot: %s",
- ctime(&tmpbuf.c_date));
fprintf(stderr, "\twanted: %s", ctime(&dumpdate));
-#endif
volno = 0;
haderror = 1;
goto again;
void
printdumpinfo(void)
{
-#ifdef __linux__
fprintf(stdout, "Dump date: %s", ctime4(&spcl.c_date));
fprintf(stdout, "Dumped from: %s",
(spcl.c_ddate == 0) ? "the epoch\n" : ctime4(&spcl.c_ddate));
-#else
- fprintf(stdout, "Dump date: %s", ctime(&spcl.c_date));
- fprintf(stdout, "Dumped from: %s",
- (spcl.c_ddate == 0) ? "the epoch\n" : ctime(&spcl.c_ddate));
-#endif
if (spcl.c_host[0] == '\0')
return;
fprintf(stdout, "Level %d dump of %s on %s:%s\n",