-.\" $OpenBSD: newfs.8,v 1.3 1996/06/23 14:31:46 deraadt Exp $
+.\" $OpenBSD: newfs.8,v 1.4 1996/12/04 08:38:58 deraadt Exp $
.\" $NetBSD: newfs.8,v 1.12 1995/03/18 14:58:41 cgd Exp $
.\"
.\" Copyright (c) 1983, 1987, 1991, 1993, 1994
.Op Fl p Ar sectors
.Op Fl r Ar revolutions
.Op Fl s Ar size
-.Op Fl t Ar tracks
+.Op Fl t Ar fstype
.Op Fl u Ar sectors
.Op Fl x Ar sectors
+.Op Fl z Ar tracks
.Ar special
.Nm mount_mfs
.Op Fl N
since they are not available to the file system for data allocation.
.It Fl r Ar revolutions/minute
The speed of the disk in revolutions per minute.
-.It Fl t Ar #tracks/cylinder
+.It Fl z Ar #tracks/cylinder
The number of tracks/cylinder available for data allocation by the file
system.
+.It Fl t Ar fstype
+Set the filesystem type of which filesystem you wish to create.
+.Nm newfs
+will be smart enough to run the alternate newfs_XXX program instead.
.It Fl u Ar sectors/track
The number of sectors per track available for data allocation by the file
system.
-/* $OpenBSD: newfs.c,v 1.5 1996/11/24 23:46:44 millert Exp $ */
+/* $OpenBSD: newfs.c,v 1.6 1996/12/04 08:38:59 deraadt Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
#if 0
static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: newfs.c,v 1.5 1996/11/24 23:46:44 millert Exp $";
+static char rcsid[] = "$OpenBSD: newfs.c,v 1.6 1996/12/04 08:38:59 deraadt Exp $";
#endif
#endif /* not lint */
#endif
#include "mntopts.h"
+#include "pathnames.h"
struct mntopt mopts[] = {
MOPT_STDOPTS,
struct statfs *mp;
int fsi, fso, len, n, maxpartitions;
char *cp, *s1, *s2, *special, *opstring, buf[BUFSIZ];
+ char *fstype = NULL;
+ char **saveargv = argv;
+ int ffs = 1;
if (progname = strrchr(*argv, '/'))
++progname;
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:r:s:t:u:x:";
- while ((ch = getopt(argc, argv, opstring)) != EOF)
+ "NOS:T:a:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:x:z:";
+ while ((ch = getopt(argc, argv, opstring)) != EOF) {
switch (ch) {
case 'N':
Nflag = 1;
if ((fssize = atoi(optarg)) <= 0)
fatal("%s: bad file system size", optarg);
break;
- case 't':
+ case 'z':
+
if ((ntracks = atoi(optarg)) <= 0)
fatal("%s: bad total tracks", optarg);
+ case 't':
+ fstype = optarg;
+ if (strcmp(fstype, "ffs"))
+ ffs = 0;
break;
case 'u':
if ((nsectors = atoi(optarg)) <= 0)
default:
usage();
}
+ if (!ffs)
+ break;
+ }
argc -= optind;
argv += optind;
- if (argc != 2 && (mfs || argc != 1))
+ if (ffs && argc != 2 && (mfs || argc != 1))
usage();
special = argv[0];
+ if (!mfs) {
+ char name[MAXPATHLEN];
+
+ if (fstype == NULL)
+ fstype = readlabelfs(special);
+ if (fstype == NULL || strcmp(fstype, "ffs")) {
+ snprintf(name, sizeof name, "%s/newfs_%s", _PATH_SBIN,
+ fstype);
+ saveargv[0] = name;
+ (void)execv(name, saveargv);
+ snprintf(name, sizeof name, "%s/newfs_%s", _PATH_USRSBIN,
+ fstype);
+ (void)execv(name, saveargv);
+ err(1, "%s not found", name);
+ }
+ }
+
if (mfs && !strcmp(special, "swap")) {
/*
* it's an MFS, mounted on "swap." fake up a label.
fprintf(stderr, "\t-p spare sectors per track\n");
fprintf(stderr, "\t-s file system size (sectors)\n");
fprintf(stderr, "\t-r revolutions/minute\n");
- fprintf(stderr, "\t-t tracks/cylinder\n");
fprintf(stderr, "\t-u sectors/track\n");
fprintf(stderr, "\t-x spare sectors per cylinder\n");
+ fprintf(stderr, "\t-z tracks/cylinder\n");
exit(1);
}
--- /dev/null
+/* $OpenBSD: pathnames.h,v 1.1 1996/12/04 08:38:59 deraadt Exp $ */
+/* $NetBSD: pathnames.h,v 1.1 1996/09/11 20:27:15 christos Exp $ */
+
+/*
+ * Copyright (c) 1996 Christos Zoulas. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christos Zoulas.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define _PATH_SBIN "/sbin"
+#define _PATH_USRSBIN "/usr/sbin"