svn commit: r258695 - head/usr.sbin/makefs

Juli Mallett jmallett at FreeBSD.org
Wed Nov 27 21:55:44 UTC 2013


Author: jmallett
Date: Wed Nov 27 21:55:43 2013
New Revision: 258695
URL: http://svnweb.freebsd.org/changeset/base/258695

Log:
  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.

Modified:
  head/usr.sbin/makefs/ffs.c

Modified: head/usr.sbin/makefs/ffs.c
==============================================================================
--- head/usr.sbin/makefs/ffs.c	Wed Nov 27 21:51:34 2013	(r258694)
+++ head/usr.sbin/makefs/ffs.c	Wed Nov 27 21:55:43 2013	(r258695)
@@ -361,6 +361,13 @@ ffs_validate(const char *dir, fsnode *ro
 	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 */


More information about the svn-src-head mailing list