aboutsummaryrefslogtreecommitdiff
path: root/sbin/mount_unionfs/mount_unionfs.c
diff options
context:
space:
mode:
authorMaxime Henrion <mux@FreeBSD.org>2002-06-15 22:48:14 +0000
committerMaxime Henrion <mux@FreeBSD.org>2002-06-15 22:48:14 +0000
commit4ce86ffd1719736b5939f1bc6630251440b398af (patch)
treee21904b9ce86a9f8628501a0f904d7b3a64d99c9 /sbin/mount_unionfs/mount_unionfs.c
parentc3210a83c03f99f816dcb3851b84652791f1561a (diff)
downloadsrc-4ce86ffd1719736b5939f1bc6630251440b398af.tar.gz
src-4ce86ffd1719736b5939f1bc6630251440b398af.zip
nmount'ify unionfs further by using separate options instead
of passing a flags mount options. This removes the include of sys/fs/unionfs/union.h in mount_unionfs as it should be. Reviewed by: phk
Notes
Notes: svn path=/head/; revision=98266
Diffstat (limited to 'sbin/mount_unionfs/mount_unionfs.c')
-rw-r--r--sbin/mount_unionfs/mount_unionfs.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/sbin/mount_unionfs/mount_unionfs.c b/sbin/mount_unionfs/mount_unionfs.c
index 44861cbb9d6d..724c9b31cbb6 100644
--- a/sbin/mount_unionfs/mount_unionfs.c
+++ b/sbin/mount_unionfs/mount_unionfs.c
@@ -52,8 +52,6 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/mount.h>
-#include <fs/unionfs/union.h>
-
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
@@ -77,26 +75,32 @@ main(argc, argv)
char *argv[];
{
struct iovec iov[8];
- int ch, mntflags, unionflags;
+ int ch, mntflags;
char source[MAXPATHLEN];
char target[MAXPATHLEN];
struct vfsconf vfc;
- int error;
+ int error, iovcnt;
+ iovcnt = 6;
mntflags = 0;
- unionflags = UNMNT_ABOVE;
while ((ch = getopt(argc, argv, "bo:r")) != -1)
switch (ch) {
case 'b':
- unionflags &= ~UNMNT_OPMASK;
- unionflags |= UNMNT_BELOW;
+ iov[6].iov_base = "below";
+ iov[6].iov_len = strlen(iov[6].iov_base) + 1;
+ iov[7].iov_base = NULL;
+ iov[7].iov_len = 0;
+ iovcnt = 8;
break;
case 'o':
getmntopts(optarg, mopts, &mntflags, 0);
break;
case 'r':
- unionflags &= ~UNMNT_OPMASK;
- unionflags |= UNMNT_REPLACE;
+ iov[6].iov_base = "replace";
+ iov[6].iov_len = strlen(iov[6].iov_base) + 1;
+ iov[7].iov_base = NULL;
+ iov[7].iov_len = 0;
+ iovcnt = 8;
break;
case '?':
default:
@@ -128,22 +132,18 @@ main(argc, argv)
errx(EX_OSERR, "union filesystem is not available");
iov[0].iov_base = "fstype";
- iov[0].iov_len = sizeof("fstype");
+ iov[0].iov_len = strlen(iov[0].iov_base) + 1;
iov[1].iov_base = vfc.vfc_name;
iov[1].iov_len = strlen(vfc.vfc_name) + 1;
iov[2].iov_base = "fspath";
- iov[2].iov_len = sizeof("fspath");
+ iov[2].iov_len = strlen(iov[2].iov_base) + 1;
iov[3].iov_base = source;
iov[3].iov_len = strlen(source) + 1;
iov[4].iov_base = "target";
- iov[4].iov_len = sizeof("target");
+ iov[4].iov_len = strlen(iov[4].iov_base) + 1;
iov[5].iov_base = target;
iov[5].iov_len = strlen(target) + 1;
- iov[6].iov_base = "unionflags";
- iov[6].iov_len = sizeof("unionflags");
- iov[7].iov_base = (char *)&unionflags;
- iov[7].iov_len = sizeof(unionflags);
- if (nmount(iov, 8, mntflags))
+ if (nmount(iov, iovcnt, mntflags))
err(EX_OSERR, "%s", target);
exit(0);
}