default)
SCCS-vsn: sbin/mount_union/mount_union.8 8.6
SCCS-vsn: sbin/mount_union/mount_union.c 8.5
.\"
.\" %sccs.include.redist.roff%
.\"
.\"
.\" %sccs.include.redist.roff%
.\"
-.\" @(#)mount_union.8 8.5 (Berkeley) %G%
+.\" @(#)mount_union.8 8.6 (Berkeley) %G%
.\"
.Dd
.Dt MOUNT_UNION 8
.\"
.Dd
.Dt MOUNT_UNION 8
.Nd mount union filesystems
.Sh SYNOPSIS
.Nm mount_union
.Nd mount union filesystems
.Sh SYNOPSIS
.Nm mount_union
-.Op Fl above
-.Op Fl below
-.Op Fl replace
.Ar directory
.Ar uniondir
.Sh DESCRIPTION
.Ar directory
.Ar uniondir
.Sh DESCRIPTION
.Pp
The options are as follows:
.Bl -tag -width indent
.Pp
The options are as follows:
.Bl -tag -width indent
+.It Fl b
+Invert the default position, so that
+.Ar directory
+becomes the lower layer and
+.Ar uniondir
+becomes the upper layer.
+However,
+.Ar uniondir
+remains the mount point.
.It Fl o
Options are specified with a
.Fl o
.It Fl o
Options are specified with a
.Fl o
See the
.Xr mount 8
man page for possible options and their meanings.
See the
.Xr mount 8
man page for possible options and their meanings.
+.It Fl r
+Hide the lower layer completely in the same way as mounting with
+.Xr mount_lofs 8
+or
+.Xr mount_null 8 .
.El
.Pp
To enforce filesystem security, the user mounting the filesystem
.El
.Pp
To enforce filesystem security, the user mounting the filesystem
.Xr mount 8
which only applies the union operation to the mount point itself,
and then only for lookups.
.Xr mount 8
which only applies the union operation to the mount point itself,
and then only for lookups.
-.Sh OPTIONS
-The options are:
-.Bl -tag -width indent
-.It Fl above
-This is the default mode of operation, where
-.Ar directory
-becomes the upper layer,
-and
-.Ar uniondir
-becomes the lower layer.
-.It Fl below
-This inverts the sense of
-.Fl above
-such that
-.Ar directory
-becomes the lower layer and
-.Ar uniondir
-becomes the upper layer.
-.Ar uniondir
-remains the mount point.
-.It Fl replace
-This simply hides the lower layer completely in
-the same way as mounting with
-.Xr mount_lofs 8
-or
-.Xr mount_null 8 .
.Sh EXAMPLES
The commands
.Bd -literal -offset indent
mount -t cd9660 -o ro /dev/cd0a /usr/src
.Sh EXAMPLES
The commands
.Bd -literal -offset indent
mount -t cd9660 -o ro /dev/cd0a /usr/src
-mount -t union -o -above /var/obj /usr/src
+mount -t union -o /var/obj /usr/src
.Ed
.Pp
mount the CD-ROM drive
.Ed
.Pp
mount the CD-ROM drive
.Pp
The command
.Bd -literal -offset indent
.Pp
The command
.Bd -literal -offset indent
-mount -t union -o -below /sys $HOME/sys
+mount -t union -o -b /sys $HOME/sys
.Ed
.Pp
attaches the system source tree below the
.Ed
.Pp
attaches the system source tree below the
objects can be done.
.Dv EROFS
is returned for this kind of operations along with any others
objects can be done.
.Dv EROFS
is returned for this kind of operations along with any others
-which would make modifictions to the lower layer, such as
+which would make modifications to the lower layer, such as
.Xr chmod 1 .
.Pp
Running
.Xr chmod 1 .
.Pp
Running
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)mount_union.c 8.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)mount_union.c 8.5 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
mntflags = 0;
args.mntflags = UNMNT_ABOVE;
mntflags = 0;
args.mntflags = UNMNT_ABOVE;
-
- while ((ch = getopt(argc, argv, "a:b:o:r:")) != EOF) {
+ while ((ch = getopt(argc, argv, "bo:r")) != EOF)
- case 'a':
- if (strcmp(optarg, "bove") != 0)
- usage();
- args.mntflags &= ~UNMNT_OPMASK;
- args.mntflags |= UNMNT_ABOVE;
- break;
- if (strcmp(optarg, "elow") != 0)
- usage();
args.mntflags &= ~UNMNT_OPMASK;
args.mntflags |= UNMNT_BELOW;
break;
args.mntflags &= ~UNMNT_OPMASK;
args.mntflags |= UNMNT_BELOW;
break;
getmntopts(optarg, mopts, &mntflags);
break;
case 'r':
getmntopts(optarg, mopts, &mntflags);
break;
case 'r':
- if (strcmp(optarg, "eplace") != 0)
- usage();
args.mntflags &= ~UNMNT_OPMASK;
args.mntflags |= UNMNT_REPLACE;
break;
case '?':
default:
usage();
args.mntflags &= ~UNMNT_OPMASK;
args.mntflags |= UNMNT_REPLACE;
break;
case '?':
default:
usage();
argc -= optind;
argv += optind;
argc -= optind;
argv += optind;
usage()
{
(void)fprintf(stderr,
usage()
{
(void)fprintf(stderr,
- "usage: mount_union [-o options] target_fs mount_point\n");
+ "usage: mount_union [-br] [-o options] target_fs mount_point\n");