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.
This commit is contained in:
parent
1679c30254
commit
5ad283b3c6
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user