summaryrefslogtreecommitdiffstats
path: root/sbin/mount_null/mount_null.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-03-11 12:40:45 +0000
committerpeter <peter@FreeBSD.org>1997-03-11 12:40:45 +0000
commit1c0f77f024b01c2df41c395b7e5afd760d0a9062 (patch)
tree8250189179b31e1866ff4aede6002aa33af8d808 /sbin/mount_null/mount_null.c
parentf461294e0761e04bbc572e265770de9410b31c41 (diff)
downloadFreeBSD-src-1c0f77f024b01c2df41c395b7e5afd760d0a9062.zip
FreeBSD-src-1c0f77f024b01c2df41c395b7e5afd760d0a9062.tar.gz
Merge from Lite2 (use new getvfsbyname() and mount(2) interface)
Diffstat (limited to 'sbin/mount_null/mount_null.c')
-rw-r--r--sbin/mount_null/mount_null.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sbin/mount_null/mount_null.c b/sbin/mount_null/mount_null.c
index 2d654c6..9269a71 100644
--- a/sbin/mount_null/mount_null.c
+++ b/sbin/mount_null/mount_null.c
@@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_null.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_null.c,v 1.7 1997/02/22 14:32:51 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -77,7 +77,8 @@ main(argc, argv)
struct null_args args;
int ch, mntflags;
char target[MAXPATHLEN];
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
mntflags = 0;
while ((ch = getopt(argc, argv, "o:")) != EOF)
@@ -104,18 +105,18 @@ main(argc, argv)
args.target = target;
- vfc = getvfsbyname("null");
- if(!vfc && vfsisloadable("null")) {
+ error = getvfsbyname("null", &vfc);
+ if (error && vfsisloadable("null")) {
if(vfsload("null"))
err(EX_OSERR, "vfsload(null)");
- endvfsent(); /* flush cache */
- vfc = getvfsbyname("null");
+ endvfsent();
+ error = getvfsbyname("null", &vfc);
}
- if (!vfc)
- errx(EX_OSERR, "null filesystem is not available");
+ if (error)
+ errx(EX_OSERR, "null/loopback filesystem is not available");
- if (mount(vfc->vfc_index, argv[1], mntflags, &args))
- err(EX_OSERR, target);
+ if (mount(vfc.vfc_name, argv[1], mntflags, &args))
+ err(1, NULL);
exit(0);
}
OpenPOWER on IntegriCloud