#ifndef lint
static const char rcsid[] =
- "$Id: optr.c,v 1.38 2004/04/21 08:55:51 stelian Exp $";
+ "$Id: optr.c,v 1.41 2010/12/06 14:13:59 stelian Exp $";
#endif /* not lint */
#include <config.h>
static void sendmes __P((const char *, const char *));
/* List of filesystem types that we can dump (same ext2 on-disk format) */
-static char *fstypes[] = { "ext2", "ext3", "InterMezzo", NULL };
+static char *fstypes[] = { "ext2", "ext3", "ext4", "InterMezzo", NULL };
/*
* Query the operator; This previously-fascist piece of code
/* Translade UUID=, LABEL= ... */
disk = get_device_name(fs->mnt_fsname);
if (disk == NULL)
- quit("Cannot find a disk having %s\n", fs->mnt_fsname);
+ disk = strdup(fs->mnt_fsname);
/* Discard non block devices */
if (stat(disk, &buf) != 0 || !S_ISBLK(buf.st_mode)) {
tabfs->mnt_passno = fs->mnt_passno;
if (!tabfs->mnt_freq)
tabfs->mnt_freq = fs->mnt_freq;
+ if (tabfs->mnt_freq > 3659)
+ quit("Dump frequency in fstab/mtab for %s is too big: %d > 3659\n",
+ tabfs->mnt_fsname, tabfs->mnt_freq);
return NULL;
}
}
quit("%s\n", strerror(errno));
new->mnt_passno = fs->mnt_passno;
new->mnt_freq = fs->mnt_freq;
+ if (new->mnt_freq > 3659)
+ quit("Dump frequency in fstab/mtab for %s %s is too big: %d > 3659\n",
+ new->mnt_dir, new->mnt_fsname, new->mnt_freq);
return (new);
}
* 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) {
+ if (level >= 0 && ddate > 365) {
char *date, *d;
date = (char *)ctime(&ddate);
* change struct fstab format.
* A positive fs_freq means this
* filesystem needs to be dumped.
+ *
+ * UGLY HACK: values in 0-3659 range indicate
+ * original value from /etc/fstab (maximum
+ * 10 years...)
+ *
+ * Values bigger than 3659 indicate that
+ * the fs is to be dumped, and the latest
+ * dump level was x-3660
+ *
+ * Negative values indicate that the fs is
+ * not to be dumped, and the latest dump
+ * level was -x-1
*/
dt->mnt_passno = dtwalk->dd_ddate;
if (dt->mnt_freq > 0 && (dtwalk->dd_ddate <
tnow - (dt->mnt_freq * 86400)))
- dt->mnt_freq = dtwalk->dd_level;
+ dt->mnt_freq = 3660 + dtwalk->dd_level;
else
- dt->mnt_freq = -dtwalk->dd_level;
+ dt->mnt_freq = -dtwalk->dd_level - 1;
#ifdef FDEBUG
printf("%s fs_freq set to %d\n", lastname,
dt->mnt_freq);
const char *disk = get_device_name(dt->mnt_fsname);
print_wmsg(arg, dt->mnt_freq > 0,
disk ? disk : dt->mnt_fsname,
- dt->mnt_freq < 0 ? -dt->mnt_freq :
- dt->mnt_freq,
+ (dt->mnt_freq < 0 ? -dt->mnt_freq - 1 :
+ dt->mnt_freq < 3660 ? -1 :
+ dt->mnt_freq - 3660),
dt->mnt_dir,
dt->mnt_passno);
}