diff options
author | peter <peter@FreeBSD.org> | 1997-03-11 12:40:45 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-03-11 12:40:45 +0000 |
commit | 1c0f77f024b01c2df41c395b7e5afd760d0a9062 (patch) | |
tree | 8250189179b31e1866ff4aede6002aa33af8d808 /sbin/mount_nullfs | |
parent | f461294e0761e04bbc572e265770de9410b31c41 (diff) | |
download | FreeBSD-src-1c0f77f024b01c2df41c395b7e5afd760d0a9062.zip FreeBSD-src-1c0f77f024b01c2df41c395b7e5afd760d0a9062.tar.gz |
Merge from Lite2 (use new getvfsbyname() and mount(2) interface)
Diffstat (limited to 'sbin/mount_nullfs')
-rw-r--r-- | sbin/mount_nullfs/Makefile | 1 | ||||
-rw-r--r-- | sbin/mount_nullfs/mount_nullfs.8 | 30 | ||||
-rw-r--r-- | sbin/mount_nullfs/mount_nullfs.c | 23 |
3 files changed, 34 insertions, 20 deletions
diff --git a/sbin/mount_nullfs/Makefile b/sbin/mount_nullfs/Makefile index 3f8b3ef..97f3c62 100644 --- a/sbin/mount_nullfs/Makefile +++ b/sbin/mount_nullfs/Makefile @@ -5,6 +5,7 @@ SRCS= mount_null.c getmntopts.c MAN8= mount_null.8 MOUNT= ${.CURDIR}/../mount +CFLAGS+= -D_NEW_VFSCONF CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT} .PATH: ${MOUNT} diff --git a/sbin/mount_nullfs/mount_nullfs.8 b/sbin/mount_nullfs/mount_nullfs.8 index 1a47b27..38473fa 100644 --- a/sbin/mount_nullfs/mount_nullfs.8 +++ b/sbin/mount_nullfs/mount_nullfs.8 @@ -34,15 +34,16 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)mount_null.8 8.4 (Berkeley) 4/19/94 -.\" $Id$ +.\" @(#)mount_null.8 8.6 (Berkeley) 5/1/95 +.\" $Id: mount_null.8,v 1.7 1997/02/22 14:32:50 peter Exp $ .\" -.Dd April 19, 1994 +.Dd May 1, 1995 .Dt MOUNT_NULL 8 .Os BSD 4.4 .Sh NAME .Nm mount_null -.Nd demonstrate the use of a null file system layer +.Nd mount a loopback filesystem sub-tree; +demonstrate the use of a null file system layer .Sh SYNOPSIS .Nm mount_null .Op Fl o Ar options @@ -54,11 +55,22 @@ The command creates a null layer, duplicating a sub-tree of the file system name space under another part of the global file system namespace. -In this respect, it is -similar to the loopback file system (see -.Xr mount_lofs 8 ) . -It differs from -the loopback file system in two respects: it is implemented using +This allows existing files and directories to be accessed +using a different pathname. +.Pp +The primary differences between a virtual copy of the filesystem +and a symbolic link are that +.Xr getcwd 3 +functions correctly in the virtual copy, and that other filesystems +may be mounted on the virtual copy without affecting the original. +A different device number for the virtual copy is returned by +.Xr stat 2 , +but in other respects it is indistinguishable from the original. +.Pp +The +.Nm mount_null +filesystem differs from a traditional +loopback file system in two respects: it is implemented using a stackable layers techniques, and it's .Do null-node diff --git a/sbin/mount_nullfs/mount_nullfs.c b/sbin/mount_nullfs/mount_nullfs.c index 2d654c6..9269a71 100644 --- a/sbin/mount_nullfs/mount_nullfs.c +++ b/sbin/mount_nullfs/mount_nullfs.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); } |