summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/makefs/ffs.c4
-rw-r--r--usr.sbin/makefs/makefs.84
-rw-r--r--usr.sbin/makefs/makefs.c14
-rw-r--r--usr.sbin/makefs/makefs.h1
4 files changed, 19 insertions, 4 deletions
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index 1647d8f..dd97c01 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -418,6 +418,10 @@ ffs_validate(const char *dir, fsnode *root, fsinfo_t *fsopts)
/* round up to the next block */
fsopts->size = roundup(fsopts->size, ffs_opts->bsize);
+ /* round up to requested block size, if any */
+ if (fsopts->roundup > 0)
+ fsopts->size = roundup(fsopts->size, fsopts->roundup);
+
/* calculate density if necessary */
if (ffs_opts->density == -1)
ffs_opts->density = fsopts->size / fsopts->inodes + 1;
diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8
index 91ab204..025066d 100644
--- a/usr.sbin/makefs/makefs.8
+++ b/usr.sbin/makefs/makefs.8
@@ -53,6 +53,7 @@
.Op Fl m Ar maximum-size
.Op Fl N Ar userdb-dir
.Op Fl o Ar fs-options
+.Op Fl r Ar roundup
.Op Fl S Ar sector-size
.Op Fl s Ar image-size
.Op Fl t Ar fs-type
@@ -195,6 +196,9 @@ Deprecated.
See the
.Fl Z
flag.
+.It Fl r Ar roundup
+Round the image up to specified block size that should be multiple
+of block size.
.It Fl S Ar sector-size
Set the file system sector size to
.Ar sector-size .
diff --git a/usr.sbin/makefs/makefs.c b/usr.sbin/makefs/makefs.c
index bf10034..5e419cc 100644
--- a/usr.sbin/makefs/makefs.c
+++ b/usr.sbin/makefs/makefs.c
@@ -113,7 +113,7 @@ main(int argc, char *argv[])
start_time.tv_sec = start.tv_sec;
start_time.tv_nsec = start.tv_usec * 1000;
- while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:ps:S:t:xZ")) != -1) {
+ while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:pr:s:S:t:xZ")) != -1) {
switch (ch) {
case 'B':
@@ -209,6 +209,12 @@ main(int argc, char *argv[])
fsoptions.sparse = 1;
break;
+ case 'r':
+ /* Round image size up to specified block size */
+ fsoptions.roundup =
+ strsuftoll("roundup", optarg, 0, LLONG_MAX);
+ break;
+
case 's':
fsoptions.minsize = fsoptions.maxsize =
strsuftoll("size", optarg, 1LL, LLONG_MAX);
@@ -359,9 +365,9 @@ usage(void)
prog = getprogname();
fprintf(stderr,
"usage: %s [-t fs-type] [-o fs-options] [-d debug-mask] [-B endian]\n"
-"\t[-S sector-size] [-M minimum-size] [-m maximum-size] [-s image-size]\n"
-"\t[-b free-blocks] [-f free-files] [-F mtree-specfile] [-xZ]\n"
-"\t[-N userdb-dir] image-file directory | manifest [extra-directory ...]\n",
+"\t[-S sector-size] [-M minimum-size] [-m maximum-size] [-r roundup ]\n"
+"\t[-s image-size] [-b free-blocks] [-f free-files] [-F mtree-specfile]\n"
+"\t[-xZ] [-N userdb-dir] image-file directory | manifest [extra-directory ...]\n",
prog);
exit(1);
}
diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h
index 5ab0444..ba80f74 100644
--- a/usr.sbin/makefs/makefs.h
+++ b/usr.sbin/makefs/makefs.h
@@ -130,6 +130,7 @@ typedef struct {
int needswap; /* non-zero if byte swapping needed */
int sectorsize; /* sector size */
int sparse; /* sparse image, don't fill it with zeros */
+ off_t roundup; /* round image size up to this value */
void *fs_specific; /* File system specific additions. */
} fsinfo_t;
OpenPOWER on IntegriCloud