diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -451,10 +451,8 @@ sblock.fs_cstotal.cs_nifree = 0; sblock.fs_cstotal.cs_nffree = 0; sblock.fs_fmod = 0; - sblock.fs_ronly = 0; sblock.fs_state = 0; sblock.fs_clean = FS_ISCLEAN; - sblock.fs_ronly = 0; sblock.fs_id[0] = tstamp; sblock.fs_id[1] = random(); sblock.fs_fsmnt[0] = '\0'; @@ -482,6 +480,10 @@ sblock.fs_old_cstotal.cs_nifree = sblock.fs_cstotal.cs_nifree; sblock.fs_old_cstotal.cs_nffree = sblock.fs_cstotal.cs_nffree; } + /* Read-Only Flag */ + sblock.fs_ronly = 0; + if (fsopts->ronly) + sblock.fs_ronly = 1; /* * Dump out summary information about file system. */ diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h --- a/usr.sbin/makefs/makefs.h +++ b/usr.sbin/makefs/makefs.h @@ -162,6 +162,7 @@ int needswap; /* non-zero if byte swapping needed */ int sectorsize; /* sector size */ int sparse; /* sparse image, don't fill it with zeros */ + int ronly; /* read-only (ro) flag */ void *fs_specific; /* File system specific additions. */ option_t *fs_options; /* File system specific options */ diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8 --- a/usr.sbin/makefs/makefs.8 +++ b/usr.sbin/makefs/makefs.8 @@ -219,6 +219,8 @@ This option only applies to the .Sy ffs file system type. +.It Fl r Ar read-only mode +Sets the ffs read-only mode flag. .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 --- a/usr.sbin/makefs/makefs.c +++ b/usr.sbin/makefs/makefs.c @@ -130,7 +130,7 @@ err(1, "Unable to get system time"); - while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:O:o:pR:s:S:t:T:xZ")) != -1) { + while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:O:o:pR:rs:S:t:T:xZ")) != -1) { switch (ch) { case 'B': @@ -237,6 +237,10 @@ strsuftoll("roundup-size", optarg, 0, LLONG_MAX); break; + case 'r': + fsoptions.ronly = 1; + break; + case 's': fsoptions.minsize = fsoptions.maxsize = strsuftoll("size", optarg, 1LL, LLONG_MAX); @@ -488,7 +492,7 @@ prog = getprogname(); fprintf(stderr, -"Usage: %s [-xZ] [-B endian] [-b free-blocks] [-d debug-mask]\n" +"Usage: %s [-rxZ] [-B endian] [-b free-blocks] [-d debug-mask]\n" "\t[-F mtree-specfile] [-f free-files] [-M minimum-size] [-m maximum-size]\n" "\t[-N userdb-dir] [-O offset] [-o fs-options] [-R roundup-size]\n" "\t[-S sector-size] [-s image-size] [-T ] [-t fs-type]\n"