Deleted Added
full compact
vfs_subr.c (192895) vfs_subr.c (193092)
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 25 unchanged lines hidden (view full) ---

34 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
35 */
36
37/*
38 * External virtual filesystem routines
39 */
40
41#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 25 unchanged lines hidden (view full) ---

34 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
35 */
36
37/*
38 * External virtual filesystem routines
39 */
40
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/sys/kern/vfs_subr.c 192895 2009-05-27 14:11:23Z jamie $");
42__FBSDID("$FreeBSD: head/sys/kern/vfs_subr.c 193092 2009-05-30 13:59:05Z trasz $");
43
44#include "opt_ddb.h"
45#include "opt_mac.h"
46
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/bio.h>
50#include <sys/buf.h>

--- 4197 unchanged lines hidden (view full) ---

4248 */
4249void
4250vfs_mark_atime(struct vnode *vp, struct ucred *cred)
4251{
4252
4253 if ((vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
4254 (void)VOP_MARKATIME(vp);
4255}
43
44#include "opt_ddb.h"
45#include "opt_mac.h"
46
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/bio.h>
50#include <sys/buf.h>

--- 4197 unchanged lines hidden (view full) ---

4248 */
4249void
4250vfs_mark_atime(struct vnode *vp, struct ucred *cred)
4251{
4252
4253 if ((vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
4254 (void)VOP_MARKATIME(vp);
4255}
4256
4257/*
4258 * The purpose of this routine is to remove granularity from accmode_t,
4259 * reducing it into standard unix access bits - VEXEC, VREAD, VWRITE,
4260 * VADMIN and VAPPEND.
4261 *
4262 * If it returns 0, the caller is supposed to continue with the usual
4263 * access checks using 'accmode' as modified by this routine. If it
4264 * returns nonzero value, the caller is supposed to return that value
4265 * as errno.
4266 *
4267 * Note that after this routine runs, accmode may be zero.
4268 */
4269int
4270vfs_unixify_accmode(accmode_t *accmode)
4271{
4272 /*
4273 * There is no way to specify explicit "deny" rule using
4274 * file mode or POSIX.1e ACLs.
4275 */
4276 if (*accmode & VEXPLICIT_DENY) {
4277 *accmode = 0;
4278 return (0);
4279 }
4280
4281 /*
4282 * None of these can be translated into usual access bits.
4283 * Also, the common case for NFSv4 ACLs is to not contain
4284 * either of these bits. Caller should check for VWRITE
4285 * on the containing directory instead.
4286 */
4287 if (*accmode & (VDELETE_CHILD | VDELETE))
4288 return (EPERM);
4289
4290 if (*accmode & VADMIN_PERMS) {
4291 *accmode &= ~VADMIN_PERMS;
4292 *accmode |= VADMIN;
4293 }
4294
4295 /*
4296 * There is no way to deny VREAD_ATTRIBUTES, VREAD_ACL
4297 * or VSYNCHRONIZE using file mode or POSIX.1e ACL.
4298 */
4299 *accmode &= ~(VSTAT_PERMS | VSYNCHRONIZE);
4300
4301 return (0);
4302}