summaryrefslogtreecommitdiffstats
path: root/sbin/newfs/newfs.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-03-11 12:48:17 +0000
committerpeter <peter@FreeBSD.org>1997-03-11 12:48:17 +0000
commit2a0adf9a128a6f75e4b31ba66ea2e11b24c5c0b0 (patch)
tree5d0712009e732548da2c201d9d56f3da5dcfd887 /sbin/newfs/newfs.c
parentbd986f80513b7e43c2cfa9a31d651ead5bd1524a (diff)
downloadFreeBSD-src-2a0adf9a128a6f75e4b31ba66ea2e11b24c5c0b0.zip
FreeBSD-src-2a0adf9a128a6f75e4b31ba66ea2e11b24c5c0b0.tar.gz
Merge from Lite2:
- use new getvfsbyname() and mount(2) interface (mount_mfs) - use new fs include files - updated inode / cg layout calculations (?)
Diffstat (limited to 'sbin/newfs/newfs.c')
-rw-r--r--sbin/newfs/newfs.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index 44058b1..7c2fe76 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94";
+static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95";
#endif /* not lint */
#ifndef lint
@@ -52,7 +52,9 @@ static char copyright[] =
#include <sys/mount.h>
#include <ufs/ufs/dir.h>
+#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
+#include <ufs/ufs/ufsmount.h>
#include <ctype.h>
#include <errno.h>
@@ -216,10 +218,11 @@ main(argc, argv)
int fsi, fso, len, n;
char *cp, *s1, *s2, *special, *opstring, buf[BUFSIZ];
#ifdef MFS
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
#endif
- if (progname = rindex(*argv, '/'))
+ if (progname = strrchr(*argv, '/'))
++progname;
else
progname = *argv;
@@ -353,7 +356,7 @@ main(argc, argv)
usage();
special = argv[0];
- cp = rindex(special, '/');
+ cp = strrchr(special, '/');
if (cp == 0) {
/*
* No path prefix; try /dev/r%s then /dev/%s.
@@ -406,8 +409,9 @@ main(argc, argv)
if ((st.st_mode & S_IFMT) != S_IFCHR && !mfs)
printf("%s: %s: not a character-special device\n",
progname, special);
- cp = index(argv[0], '\0') - 1;
- if (cp == 0 || (*cp < 'a' || *cp > 'h') && !isdigit(*cp))
+ cp = strchr(argv[0], '\0') - 1;
+ if (cp == (char *)-1 ||
+ (*cp < 'a' || *cp > 'h') && !isdigit(*cp))
fatal("%s: can't figure out file system partition",
argv[0]);
#ifdef COMPAT
@@ -566,17 +570,17 @@ main(argc, argv)
args.base = membase;
args.size = fssize * sectorsize;
- vfc = getvfsbyname("mfs");
- if(!vfc && vfsisloadable("mfs")) {
- if(vfsload("mfs")) {
- err(1, "vfsload(mfs)");
- }
+ error = getvfsbyname("mfs", &vfc);
+ if (error && vfsisloadable("mfs")) {
+ if (vfsload("mfs"))
+ fatal("vfsload(mfs)");
endvfsent(); /* flush cache */
- vfc = getvfsbyname("mfs");
+ error = getvfsbyname("mfs", &vfc);
}
+ if (error)
+ fatal("mfs filesystem not available");
- if (mount(vfc ? vfc->vfc_index : MOUNT_MFS, argv[1], mntflags,
- &args) < 0)
+ if (mount(vfc.vfc_name, argv[1], mntflags, &args) < 0)
fatal("%s: %s", argv[1], strerror(errno));
if(filename) {
munmap(membase,fssize * sectorsize);
OpenPOWER on IntegriCloud