aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuli Mallett <jmallett@FreeBSD.org>2013-11-27 21:55:43 +0000
committerJuli Mallett <jmallett@FreeBSD.org>2013-11-27 21:55:43 +0000
commit5ad283b3c60d63086221068d6f7619bfe7650d2d (patch)
tree37f594bfe038b3f225d2c18f13951ff934a7bce3
parent1679c3025474d5adf98639bcb9b4f61f51fc5240 (diff)
downloadsrc-5ad283b3c60d63086221068d6f7619bfe7650d2d.tar.gz
src-5ad283b3c60d63086221068d6f7619bfe7650d2d.zip
Provide a helpful diagnostic when the minimum size rounded to the block size
would exceed the maximum size. This can be a difficult problem to diagnose if one is, for instance, using -s with a fixed size in a script and the bsize calculated for a filesystem image changes, necessitating a re-rounding of the image size or a hand-setting of the bsize. Previously one would get a cryptic message about how the size exceeded the maximum size, which normally only happens if the contents of the image are larger than specified.
Notes
Notes: svn path=/head/; revision=258695
-rw-r--r--usr.sbin/makefs/ffs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index 0417d86095ec..92d5508f5d24 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -361,6 +361,13 @@ ffs_validate(const char *dir, fsnode *root, fsinfo_t *fsopts)
if (ffs_opts->avgfpdir == -1)
ffs_opts->avgfpdir = AFPDIR;
+ if (roundup(fsopts->minsize, ffs_opts->bsize) > fsopts->maxsize)
+ errx(1, "`%s' minsize of %lld rounded up to ffs bsize of %d "
+ "exceeds maxsize %lld. Lower bsize, or round the minimum "
+ "and maximum sizes to bsize.", dir,
+ (long long)fsopts->minsize, ffs_opts->bsize,
+ (long long)fsopts->maxsize);
+
/* calculate size of tree */
ffs_size_dir(root, fsopts);
fsopts->inodes += ROOTINO; /* include first two inodes */