summaryrefslogtreecommitdiffstats
path: root/sys/fs/unionfs
diff options
context:
space:
mode:
authordaichi <daichi@FreeBSD.org>2008-11-25 03:49:41 +0000
committerdaichi <daichi@FreeBSD.org>2008-11-25 03:49:41 +0000
commit74c7aac5194ffda6cbf6adac3928395d4b4b02f5 (patch)
tree20c7b4782bbd5abd510adce147f9238598ad1bf0 /sys/fs/unionfs
parente83e7f761d426790d991912e06adf6db24a6b00b (diff)
downloadFreeBSD-src-74c7aac5194ffda6cbf6adac3928395d4b4b02f5.zip
FreeBSD-src-74c7aac5194ffda6cbf6adac3928395d4b4b02f5.tar.gz
Simplify mode_t check treatment (suggested by trasz).
By semantical view, trasz's code is better than prior one. Submitted by: trasz Reviewed by: Masanori OZAWA <ozawa@ongs.co.jp>
Diffstat (limited to 'sys/fs/unionfs')
-rw-r--r--sys/fs/unionfs/union_vfsops.c41
1 files changed, 2 insertions, 39 deletions
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index 768c94d..d74d1ea 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -67,43 +67,6 @@ static vfs_extattrctl_t unionfs_extattrctl;
static struct vfsops unionfs_vfsops;
/*
- * Exchange from userland file mode to vmode.
- */
-static u_short
-mode2vmode(mode_t mode)
-{
- u_short ret;
-
- ret = 0;
-
- /* other */
- if (mode & S_IXOTH)
- ret |= VEXEC >> 6;
- if (mode & S_IWOTH)
- ret |= VWRITE >> 6;
- if (mode & S_IROTH)
- ret |= VREAD >> 6;
-
- /* group */
- if (mode & S_IXGRP)
- ret |= VEXEC >> 3;
- if (mode & S_IWGRP)
- ret |= VWRITE >> 3;
- if (mode & S_IRGRP)
- ret |= VREAD >> 3;
-
- /* owner */
- if (mode & S_IXUSR)
- ret |= VEXEC;
- if (mode & S_IWUSR)
- ret |= VWRITE;
- if (mode & S_IRUSR)
- ret |= VREAD;
-
- return (ret);
-}
-
-/*
* Mount unionfs layer.
*/
static int
@@ -174,7 +137,7 @@ unionfs_domount(struct mount *mp, struct thread *td)
vfs_mount_error(mp, "Invalid udir");
return (EINVAL);
}
- udir = mode2vmode(udir);
+ udir &= S_IRWXU | S_IRWXG | S_IRWXO;
}
if (vfs_getopt(mp->mnt_optnew, "ufile", (void **)&tmp, NULL) == 0) {
if (tmp != NULL)
@@ -183,7 +146,7 @@ unionfs_domount(struct mount *mp, struct thread *td)
vfs_mount_error(mp, "Invalid ufile");
return (EINVAL);
}
- ufile = mode2vmode(ufile);
+ ufile &= S_IRWXU | S_IRWXG | S_IRWXO;
}
/* check umask, uid and gid */
if (udir == 0 && ufile != 0)
OpenPOWER on IntegriCloud