From 8bfad78a38f63cccdfba87667adf9b6151524088 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Mon, 18 Jun 2001 11:07:45 +0000 Subject: [PATCH] Report any filesystem present in either /etc/fstab with a positive passno or /etc/dumpdates in dump -w output. --- CHANGES | 6 +++++- dump/optr.c | 48 +++++++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/CHANGES b/CHANGES index 494017f..2ed2c17 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.117 2001/06/18 10:58:27 stelian Exp $ +$Id: CHANGES,v 1.118 2001/06/18 11:07:45 stelian Exp $ Changes between versions 0.4b22 and 0.4b23 (released ????????????) ================================================================== @@ -14,6 +14,10 @@ Changes between versions 0.4b22 and 0.4b23 (released ????????????) latest version of this file. Patch submitted by Andreas Dilger . +4. Report any filesystem present in either /etc/fstab with a + positive passno or /etc/dumpdates in dump -w output. + Patch submitted by Andreas Dilger . + Changes between versions 0.4b21 and 0.4b22 (released May 12, 2001) ================================================================== diff --git a/dump/optr.c b/dump/optr.c index 471ea5b..88ff63d 100644 --- a/dump/optr.c +++ b/dump/optr.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: optr.c,v 1.23 2001/06/18 10:58:28 stelian Exp $"; + "$Id: optr.c,v 1.24 2001/06/18 11:07:45 stelian Exp $"; #endif /* not lint */ #include @@ -463,7 +463,6 @@ getfstab(void) strcmp(fs->fs_type, FSTAB_RQ)) continue; fs = allocfsent(fs); - fs->fs_passno = 0; if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL) quit("%s\n", strerror(errno)); pf->pf_fstab = fs; @@ -559,15 +558,9 @@ static void print_wmsg(char arg, int dumpme, const char *dev, int level, const char *mtpt, time_t ddate) { - char *date = NULL; - - if (ddate) { - char *d; - date = (char *)ctime(&ddate); - d = strchr(date, '\n'); - if (d) *d = '\0'; - } - +#ifdef FDEBUG + printf("checking dev %s: lvl %d, mtpt %s\n", dev, level, mtpt); +#endif if (!dumpme && arg == 'w') return; @@ -576,10 +569,18 @@ print_wmsg(char arg, int dumpme, const char *dev, int level, dev, mtpt ? mtpt : ""); - if (ddate) - printf("Level %c, Date %s\n", - level, date); - else + /* + * Check ddate > 365 to avoid issues with fs in stab but not dumpdates. + * Not a problem, because ddate is in seconds since the epoch anyways. + */ + if (ddate > 365) { + char *date, *d; + + date = (char *)ctime(&ddate); + d = strchr(date, '\n'); + if (d) *d = '\0'; + printf("Level %c, Date %s\n", level, date); + } else printf("never\n"); } @@ -606,6 +607,7 @@ lastdump(char arg) /* w ==> just what to do; W ==> most recent dumps */ else (void) printf("Last dump(s) done (Dump '>' file systems):\n"); + /* For files in dumpdates, get the last dump level and date */ if (ddatev != NULL) { struct dumpdates *dtwalk = NULL; int i; @@ -624,16 +626,19 @@ lastdump(char arg) /* w ==> just what to do; W ==> most recent dumps */ /* Overload fs_freq as dump level and * fs_passno as date, because we can't * change struct fstab format. - * A negative fs_freq means this + * A positive fs_freq means this * filesystem needs to be dumped. */ dt->fs_passno = dtwalk->dd_ddate; if (dt->fs_freq > 0 && (dtwalk->dd_ddate < tnow - (dt->fs_freq * 86400))) - dt->fs_freq = -dtwalk->dd_level - 1; + dt->fs_freq = dtwalk->dd_level; else - dt->fs_freq = dtwalk->dd_level + 1; - + dt->fs_freq = -dtwalk->dd_level; +#ifdef FDEBUG + printf("%s fs_freq set to %d\n", lastname, + dt->fs_freq); +#endif } } } @@ -647,9 +652,10 @@ lastdump(char arg) /* w ==> just what to do; W ==> most recent dumps */ if (strncmp(dt->fs_vfstype, *type, sizeof(dt->fs_vfstype)) == 0) { const char *disk = get_device_name(dt->fs_spec); - print_wmsg(arg, dt->fs_freq < 0, + print_wmsg(arg, dt->fs_freq > 0, disk ? disk : dt->fs_spec, - dt->fs_freq < 0 ? -dt->fs_freq - 1 : dt->fs_freq - 1, + dt->fs_freq < 0 ? -dt->fs_freq : + dt->fs_freq, dt->fs_file, dt->fs_passno); } -- 2.39.5