summaryrefslogtreecommitdiff
path: root/sbin/newfs
diff options
context:
space:
mode:
authorGrigoriy Orlov <gluk@cvs.openbsd.org>2001-04-19 16:22:19 +0000
committerGrigoriy Orlov <gluk@cvs.openbsd.org>2001-04-19 16:22:19 +0000
commite6b97ebf903a720407574154e9d255be05af6a78 (patch)
treef73bf1383c88151e3e7918ff10a5893bf89ee82d /sbin/newfs
parent41d17e79c339aa7b59c1b00e6d2603868d348f2e (diff)
Cleanup dirpref and synhronize superblock with freebsd.
From FreeBSD with little changes. art@ ok.
Diffstat (limited to 'sbin/newfs')
-rw-r--r--sbin/newfs/mkfs.c17
-rw-r--r--sbin/newfs/newfs.c18
2 files changed, 30 insertions, 5 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index aacecf48349..947382b6e5d 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkfs.c,v 1.17 2001/04/13 02:39:06 gluk Exp $ */
+/* $OpenBSD: mkfs.c,v 1.18 2001/04/19 16:22:17 gluk Exp $ */
/* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)mkfs.c 8.3 (Berkeley) 2/3/94";
#else
-static char rcsid[] = "$OpenBSD: mkfs.c,v 1.17 2001/04/13 02:39:06 gluk Exp $";
+static char rcsid[] = "$OpenBSD: mkfs.c,v 1.18 2001/04/19 16:22:17 gluk Exp $";
#endif
#endif /* not lint */
@@ -105,6 +105,8 @@ extern int maxbpg; /* maximum blocks per file in a cyl group */
extern int nrpos; /* # of distinguished rotational positions */
extern int bbsize; /* boot block size */
extern int sbsize; /* superblock size */
+extern int avgfilesize; /* expected average file size */
+extern int avgfilesperdir; /* expected number of files per directory */
extern int quiet; /* quiet flag */
extern u_long memleft; /* virtual memory available */
extern caddr_t membase; /* start address of memory based filesystem */
@@ -206,6 +208,17 @@ recalc:
if (sblock.fs_nsect <= 0)
printf("preposterous nsect %d\n", sblock.fs_nsect), exit(15);
/*
+ * collect and verify the filesystem density info
+ */
+ sblock.fs_avgfilesize = avgfilesize;
+ sblock.fs_avgfpdir = avgfilesperdir;
+ if (sblock.fs_avgfilesize <= 0)
+ printf("illegal expected average file size %d\n",
+ sblock.fs_avgfilesize), exit(14);
+ if (sblock.fs_avgfpdir <= 0)
+ printf("illegal expected number of files per directory %d\n",
+ sblock.fs_avgfpdir), exit(15);
+ /*
* collect and verify the block and fragment sizes
*/
sblock.fs_bsize = bsize;
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index 77d72a36ba3..301173b9335 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newfs.c,v 1.26 2001/04/14 03:15:54 gluk Exp $ */
+/* $OpenBSD: newfs.c,v 1.27 2001/04/19 16:22:18 gluk Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: newfs.c,v 1.26 2001/04/14 03:15:54 gluk Exp $";
+static char rcsid[] = "$OpenBSD: newfs.c,v 1.27 2001/04/19 16:22:18 gluk Exp $";
#endif
#endif /* not lint */
@@ -175,6 +175,8 @@ int maxcontig = 8; /* max contiguous blocks to allocate */
int rotdelay = ROTDELAY; /* rotational delay between blocks */
int maxbpg; /* maximum blocks per file in a cyl group */
int nrpos = NRPOS; /* # of distinguished rotational positions */
+int avgfilesize = AVFILESIZ;/* expected average file size */
+int avgfilesperdir = AFPDIR;/* expected number of files per directory */
int bbsize = BBSIZE; /* boot block size */
int sbsize = SBSIZE; /* superblock size */
int mntflags = MNT_ASYNC; /* flags to be passed to mount */
@@ -218,7 +220,7 @@ main(argc, argv)
opstring = mfs ?
"NT:a:b:c:d:e:f:i:m:o:s:" :
- "NOS:T:a:b:c:d:e:f:i:k:l:m:n:o:p:qr:s:t:u:x:z:";
+ "NOS:T:a:b:c:d:e:f:g:h:i:k:l:m:n:o:p:qr:s:t:u:x:z:";
while ((ch = getopt(argc, argv, opstring)) != -1) {
switch (ch) {
case 'N':
@@ -263,6 +265,14 @@ main(argc, argv)
if ((fsize = atoi(optarg)) <= 0)
fatal("%s: bad fragment size", optarg);
break;
+ case 'g':
+ if ((avgfilesize = atoi(optarg)) <= 0)
+ fatal("%s: bad average file size", optarg);
+ break;
+ case 'h':
+ if ((avgfilesperdir = atoi(optarg)) <= 0)
+ fatal("%s: bad average files per dir", optarg);
+ break;
case 'i':
if ((density = atoi(optarg)) <= 0)
fatal("%s: bad bytes per inode\n", optarg);
@@ -728,6 +738,8 @@ struct fsoptions {
{ "-d rotational delay between contiguous blocks", 1 },
{ "-e maximum blocks per file in a cylinder group", 1 },
{ "-f frag size", 1 },
+ { "-g average file size", 0 },
+ { "-h average files per directory", 0 },
{ "-i number of bytes per inode", 1 },
{ "-k sector 0 skew, per track", 0 },
{ "-l hardware sector interleave", 0 },