From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 03:49:41 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E7CE1065670; Tue, 25 Nov 2008 03:49:41 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88BEF8FC08; Tue, 25 Nov 2008 03:49:41 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP3nf28007573; Tue, 25 Nov 2008 03:49:41 GMT (envelope-from daichi@svn.freebsd.org) Received: (from daichi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP3nfFX007572; Tue, 25 Nov 2008 03:49:41 GMT (envelope-from daichi@svn.freebsd.org) Message-Id: <200811250349.mAP3nfFX007572@svn.freebsd.org> From: Daichi GOTO Date: Tue, 25 Nov 2008 03:49:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185284 - head/sys/fs/unionfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 03:49:41 -0000 Author: daichi Date: Tue Nov 25 03:49:41 2008 New Revision: 185284 URL: http://svn.freebsd.org/changeset/base/185284 Log: 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 Modified: head/sys/fs/unionfs/union_vfsops.c Modified: head/sys/fs/unionfs/union_vfsops.c ============================================================================== --- head/sys/fs/unionfs/union_vfsops.c Tue Nov 25 03:18:35 2008 (r185283) +++ head/sys/fs/unionfs/union_vfsops.c Tue Nov 25 03:49:41 2008 (r185284) @@ -67,43 +67,6 @@ static vfs_extattrctl_t unionfs_extattrc 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 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 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)