From 4ce86ffd1719736b5939f1bc6630251440b398af Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Sat, 15 Jun 2002 22:48:14 +0000 Subject: 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 --- sys/fs/unionfs/union.h | 1 - sys/fs/unionfs/union_vfsops.c | 21 ++++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'sys/fs') 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: -- cgit v1.3