diff options
author | mux <mux@FreeBSD.org> | 2002-06-15 22:48:14 +0000 |
---|---|---|
committer | mux <mux@FreeBSD.org> | 2002-06-15 22:48:14 +0000 |
commit | 62289e8461aa01c16367d44b6e2f109737065bfa (patch) | |
tree | e21904b9ce86a9f8628501a0f904d7b3a64d99c9 /sys/fs/unionfs | |
parent | a9b7ee8dc7c3c2068241f4fbe5ee281eec5529ac (diff) | |
download | FreeBSD-src-62289e8461aa01c16367d44b6e2f109737065bfa.zip FreeBSD-src-62289e8461aa01c16367d44b6e2f109737065bfa.tar.gz |
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
Diffstat (limited to 'sys/fs/unionfs')
-rw-r--r-- | sys/fs/unionfs/union.h | 1 | ||||
-rw-r--r-- | sys/fs/unionfs/union_vfsops.c | 21 |
2 files changed, 16 insertions, 6 deletions
diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h index 28e153e..3a2ee2a 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 eb214e9..c4d362c 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: |