Address PR 7412: fix newfs_lfs.8 to list all real options for newfs_lfs;

also fix newfs_lfs to get rid of all sorts of useless options that applied
only to newfs_ffs.  Corrected reference to the FFS paper to the reference
to the BSD-LFS paper.
This commit is contained in:
perseant 1999-07-15 19:09:40 +00:00
parent 5122ae5f44
commit 7fa6616468
2 changed files with 36 additions and 168 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: newfs.c,v 1.1 1999/03/18 17:18:05 perseant Exp $ */
/* $NetBSD: newfs.c,v 1.2 1999/07/15 19:09:40 perseant Exp $ */
/*-
* Copyright (c) 1989, 1992, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)newfs.c 8.5 (Berkeley) 5/24/95";
#else
__RCSID("$NetBSD: newfs.c,v 1.1 1999/03/18 17:18:05 perseant Exp $");
__RCSID("$NetBSD: newfs.c,v 1.2 1999/07/15 19:09:40 perseant Exp $");
#endif
#endif /* not lint */
@ -76,38 +76,14 @@ __RCSID("$NetBSD: newfs.c,v 1.1 1999/03/18 17:18:05 perseant Exp $");
#define COMPAT /* allow non-labeled disks */
int mfs; /* run as the memory based filesystem */
int Nflag; /* run without writing file system */
int fssize; /* file system size */
int ntracks; /* # tracks/cylinder */
int nsectors; /* # sectors/track */
int nphyssectors; /* # sectors/track including spares */
int secpercyl; /* sectors per cylinder */
int trackspares = -1; /* spare sectors per track */
int cylspares = -1; /* spare sectors per cylinder */
int sectorsize; /* bytes/sector */
#ifdef tahoe
int realsectorsize; /* bytes/sector in hardware */
#endif
int rpm; /* revolutions/minute of drive */
int interleave; /* hardware sector interleave */
int trackskew = -1; /* sector 0 skew, per track */
int headswitch; /* head switch time, usec */
int trackseek; /* track-to-track seek, usec */
int fsize = 0; /* fragment size */
int bsize = 0; /* block size */
int cpg = DESCPG; /* cylinders/cylinder group */
int cpgflg; /* cylinders/cylinder group flag was given */
int minfree = MINFREE; /* free space threshold */
int opt = DEFAULTOPT; /* optimization preference (space or time) */
int density; /* number of bytes per inode */
int maxcontig = MAXCONTIG; /* 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 bbsize = BBSIZE; /* boot block size */
int sbsize = SBSIZE; /* superblock size */
int mntflags; /* flags to be passed to mount */
u_long memleft; /* virtual memory available */
caddr_t membase; /* start address of memory based filesystem */
#ifdef COMPAT
@ -143,19 +119,11 @@ main(argc, argv)
else
progname = *argv;
if (strstr(progname, "mfs")) {
mfs = 1;
Nflag++;
}
maxpartitions = getmaxpartitions();
if (maxpartitions > 26)
fatal("insane maxpartitions value %d", maxpartitions);
/* -F is mfs only and MUST come first! */
opstring = "F:B:DLNS:T:a:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:x:";
if (!mfs)
opstring += 2;
opstring = "B:DLNb:f:m:s:";
debug = lfs = segsize = 0;
while ((ch = getopt(argc, argv, opstring)) != -1)
@ -167,108 +135,33 @@ main(argc, argv)
case 'D':
debug = 1;
break;
case 'F':
if ((mntflags = atoi(optarg)) == 0)
fatal("%s: bad mount flags", optarg);
break;
case 'L': /* Create lfs */
lfs = 1;
break;
case 'N':
Nflag++;
break;
case 'S':
if ((sectorsize = atoi(optarg)) <= 0)
fatal("%s: bad sector size", optarg);
break;
#ifdef COMPAT
case 'T':
disktype = optarg;
break;
#endif
case 'a':
if ((maxcontig = atoi(optarg)) <= 0)
fatal("%s: bad max contiguous blocks\n",
optarg);
break;
break;
#endif
case 'b': /* used for LFS */
if ((bsize = atoi(optarg)) < LFS_MINBLOCKSIZE)
fatal("%s: bad block size", optarg);
break;
case 'c':
if ((cpg = atoi(optarg)) <= 0)
fatal("%s: bad cylinders/group", optarg);
cpgflg++;
break;
case 'd':
if ((rotdelay = atoi(optarg)) < 0)
fatal("%s: bad rotational delay\n", optarg);
break;
case 'e':
if ((maxbpg = atoi(optarg)) <= 0)
fatal("%s: bad blocks per file in a cyl group\n",
optarg);
break;
case 'f':
if ((fsize = atoi(optarg)) <= 0)
fatal("%s: bad frag size", optarg);
break;
case 'i':
if ((density = atoi(optarg)) <= 0)
fatal("%s: bad bytes per inode\n", optarg);
break;
case 'k':
if ((trackskew = atoi(optarg)) < 0)
fatal("%s: bad track skew", optarg);
break;
case 'l':
if ((interleave = atoi(optarg)) <= 0)
fatal("%s: bad interleave", optarg);
break;
case 'm': /* used for LFS */
case 'm':
if ((minfree = atoi(optarg)) < 0 || minfree > 99)
fatal("%s: bad free space %%\n", optarg);
break;
case 'n':
if ((nrpos = atoi(optarg)) <= 0)
fatal("%s: bad rotational layout count\n",
optarg);
break;
case 'o':
if (strcmp(optarg, "space") == 0)
opt = FS_OPTSPACE;
else if (strcmp(optarg, "time") == 0)
opt = FS_OPTTIME;
else
fatal("%s: bad optimization preference %s",
optarg, "(options are `space' or `time')");
break;
case 'p':
if ((trackspares = atoi(optarg)) < 0)
fatal("%s: bad spare sectors per track",
optarg);
break;
case 'r':
if ((rpm = atoi(optarg)) <= 0)
fatal("%s: bad revs/minute\n", optarg);
break;
case 's': /* used for LFS */
case 's':
if ((fssize = atoi(optarg)) <= 0)
fatal("%s: bad file system size", optarg);
break;
case 't':
if ((ntracks = atoi(optarg)) <= 0)
fatal("%s: bad total tracks", optarg);
break;
case 'u':
if ((nsectors = atoi(optarg)) <= 0)
fatal("%s: bad sectors/track", optarg);
break;
case 'x':
if ((cylspares = atoi(optarg)) < 0)
fatal("%s: bad spare sectors per cylinder",
optarg);
break;
case '?':
default:
usage();
@ -276,7 +169,7 @@ main(argc, argv)
argc -= optind;
argv += optind;
if (argc != 2 && (mfs || argc != 1))
if (argc != 2 && argc != 1)
usage();
/*
@ -307,7 +200,7 @@ main(argc, argv)
if (fstat(fsi, &st) < 0)
fatal("%s: %s", special, strerror(errno));
if (!debug && !mfs && !S_ISCHR(st.st_mode))
if (!debug && !S_ISCHR(st.st_mode))
(void)printf("%s: %s: not a character-special device\n",
progname, special);
cp = strchr(argv[0], '\0') - 1;
@ -317,7 +210,7 @@ main(argc, argv)
fatal("%s: can't figure out file system partition", argv[0]);
#ifdef COMPAT
if (!mfs && disktype == NULL)
if (disktype == NULL)
disktype = argv[1];
#endif
if (debug)
@ -443,45 +336,16 @@ rewritelabel(s, fd, lp)
void
usage()
{
if (mfs) {
fprintf(stderr,
"usage: mfs [ -fsoptions ] special-device mount-point\n");
} else
fprintf(stderr,
"usage: newfs_lfs [ -fsoptions ] special-device%s\n",
#ifdef COMPAT
" [device-type]");
#else
"");
#endif
fprintf(stderr, "usage: newfs_lfs [ -fsoptions ] special-device\n");
fprintf(stderr, "where fsoptions are:\n");
fprintf(stderr, "\t-B LFS segment size\n");
fprintf(stderr, "\t-D debug\n");
fprintf(stderr, "\t-F mount flags\n");
fprintf(stderr, "\t-L create LFS file system\n");
/* fprintf(stderr, "\t-L create LFS file system\n"); */
fprintf(stderr,
"\t-N do not create file system, just print out parameters\n");
fprintf(stderr, "\t-S sector size\n");
#ifdef COMPAT
fprintf(stderr, "\t-T disktype\n");
#endif
fprintf(stderr, "\t-a maximum contiguous blocks\n");
fprintf(stderr, "\t-b block size\n");
fprintf(stderr, "\t-c cylinders/group\n");
fprintf(stderr, "\t-d rotational delay between contiguous blocks\n");
fprintf(stderr, "\t-e maximum blocks per file in a cylinder group\n");
fprintf(stderr, "\t-f frag size\n");
fprintf(stderr, "\t-i number of bytes per inode\n");
fprintf(stderr, "\t-k sector 0 skew, per track\n");
fprintf(stderr, "\t-l hardware sector interleave\n");
fprintf(stderr, "\t-m minimum free space %%\n");
fprintf(stderr, "\t-n number of distinguished rotational positions\n");
fprintf(stderr, "\t-o optimization preference (`space' or `time')\n");
fprintf(stderr, "\t-p spare sectors per track\n");
fprintf(stderr, "\t-r revolutions/minute\n");
fprintf(stderr, "\t-s file system size (sectors)\n");
fprintf(stderr, "\t-t tracks/cylinder\n");
fprintf(stderr, "\t-u sectors/track\n");
fprintf(stderr, "\t-x spare sectors per cylinder\n");
exit(1);
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: newfs_lfs.8,v 1.1 1999/03/18 17:18:05 perseant Exp $
.\" $NetBSD: newfs_lfs.8,v 1.2 1999/07/15 19:09:41 perseant Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@ -33,15 +33,14 @@
.\"
.\" @(#)newlfs.8 8.1 (Berkeley) 6/19/93
.\"
.Dd June 19, 1993
.Dt NEWLFS 8
.Dd July 15, 1999
.Dt NEWFS_LFS 8
.Os BSD 4.4
.Sh NAME
.Nm newfs_lfs
.Nd construct a new LFS file system
.Sh SYNOPSIS
.Nm
.Fl L
.Op Ar newfs_lfs-options
.Ar special
.Sh DESCRIPTION
@ -59,39 +58,44 @@ The following options define the general layout policies.
The logical segment size of the file system in bytes.
.It Fl b Ar block-size
The block size of the file system in bytes.
.It Fl f Ar fragment-size
The fragment size of the file system in bytes.
.It Fl L
Create a log-structured file system (LFS).
This flag is currently required.
Create a log-structured file system (LFS). This is the default, and this
option is provided for compatibility only.
.It Fl m Ar free space \&%
The percentage of space reserved from normal users; the minimum
free space threshold. The default value used is 10%.
See
.Xr tunefs 8
for more details on how to set this option.
.It Fl N
Do not actually create the filesystem.
.It Fl s Ar size
The size of the file system in sectors.
.El
.Sh SEE ALSO
.Xr disktab 5 ,
.Xr fs 5 ,
.\" .Xr fs 5 ,
.Xr dumplfs 8 ,
.Xr disklabel 8 ,
.Xr diskpart 8 ,
.Xr tunefs 8
.\" .Xr tunefs 8
.Rs
.%A M. Seltzer
.%A K. Bostic
.%A M. McKusick
.%A W. Joy
.%A S. Leffler
.%A R. Fabry
.%T A Fast File System for UNIX ,
.%J ACM Transactions on Computer Systems 2
.%V 3
.%P pp 181-197
.%D August 1984
.%O (reprinted in the BSD System Manager's Manual)
.%A C. Staelin
.%T "An Implementation of a Log-Structured File System for UNIX"
.%J "Proceedings of the Winter 1993 USENIX Conference"
.%D January 25-29, 1993
.%P pp. 315-331
.Re
.Sh HISTORY
The
.Nm
A \fBnewlfs\fR
command appeared in
.Bx 4.4 .
.Bx 4.4 ,
and was renamed to
.Nm
for
.Nx 1.4.