aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
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 /sys/fs
parentc3210a83c03f99f816dcb3851b84652791f1561a (diff)
Notes
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/unionfs/union.h1
-rw-r--r--sys/fs/unionfs/union_vfsops.c21
2 files changed, 16 insertions, 6 deletions
diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h
index 28e153e6c0927..3a2ee2a4c4f93 100644
--- a/sys/fs/unionfs/union.h
+++ b/sys/fs/unionfs/union.h
@@ -41,7 +41,6 @@
#define UNMNT_ABOVE 0x0001 /* Target appears above mount point */
#define UNMNT_BELOW 0x0002 /* Target appears below mount point */
#define UNMNT_REPLACE 0x0003 /* Target replaces mount point */
-#define UNMNT_OPMASK 0x0003
struct union_mount {
struct vnode *um_uppervp; /* UN_ULOCK holds locking state */
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index eb214e94294e6..c4d362c5c2679 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -82,7 +82,7 @@ union_mount(mp, ndp, td)
struct union_mount *um = 0;
struct ucred *cred = 0;
char *cp = 0, *target;
- int *flags;
+ int op;
int len;
u_int size;
@@ -112,9 +112,20 @@ union_mount(mp, ndp, td)
if (error || target[len - 1] != '\0')
return (EINVAL);
- error = vfs_getopt(opts, "unionflags", (void **)&flags, &len);
- if (error || len != sizeof(int))
- return (EINVAL);
+ op = 0;
+ if (vfs_getopt(opts, "below", NULL, NULL) == 0)
+ op = UNMNT_BELOW;
+ if (vfs_getopt(opts, "replace", NULL, NULL) == 0) {
+ /* These options are mutually exclusive. */
+ if (op)
+ return (EINVAL);
+ op = UNMNT_REPLACE;
+ }
+ /*
+ * UNMNT_ABOVE is the default.
+ */
+ if (op == 0)
+ op = UNMNT_ABOVE;
/*
* Obtain lower vnode. Vnode is stored in mp->mnt_vnodecovered.
@@ -184,7 +195,7 @@ union_mount(mp, ndp, td)
um = (struct union_mount *) malloc(sizeof(struct union_mount),
M_UNIONFSMNT, M_WAITOK | M_ZERO);
- um->um_op = *flags & UNMNT_OPMASK;
+ um->um_op = op;
switch (um->um_op) {
case UNMNT_ABOVE: