summaryrefslogtreecommitdiffstats
path: root/share/man/man9/VOP_ACCESS.9
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2008-10-28 13:44:11 +0000
committertrasz <trasz@FreeBSD.org>2008-10-28 13:44:11 +0000
commit0ad8692247694171bf2d3f963f24b15f5223a0de (patch)
treecb5d9bbe34cd6eae2c3dd212bdfdfd85569424dd /share/man/man9/VOP_ACCESS.9
parentbc6713490924420312442a3f3fc4ef1fe4b8e400 (diff)
downloadFreeBSD-src-0ad8692247694171bf2d3f963f24b15f5223a0de.zip
FreeBSD-src-0ad8692247694171bf2d3f963f24b15f5223a0de.tar.gz
Introduce accmode_t. This is required for NFSv4 ACLs - it will be neccessary
to add more V* constants, and the variables changed by this patch were often being assigned to mode_t variables, which is 16 bit. Approved by: rwatson (mentor)
Diffstat (limited to 'share/man/man9/VOP_ACCESS.9')
-rw-r--r--share/man/man9/VOP_ACCESS.934
1 files changed, 17 insertions, 17 deletions
diff --git a/share/man/man9/VOP_ACCESS.9 b/share/man/man9/VOP_ACCESS.9
index 55a9302..73eb2b5 100644
--- a/share/man/man9/VOP_ACCESS.9
+++ b/share/man/man9/VOP_ACCESS.9
@@ -39,16 +39,16 @@
.In sys/param.h
.In sys/vnode.h
.Ft int
-.Fn VOP_ACCESS "struct vnode *vp" "int mode" "struct ucred *cred" "struct thread *td"
+.Fn VOP_ACCESS "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
.Sh DESCRIPTION
This entry point checks the access permissions of the file against the
given credentials.
.Pp
Its arguments are:
-.Bl -tag -width mode
+.Bl -tag -width accmode
.It Fa vp
The vnode of the file to check.
-.It Fa mode
+.It Fa accmode
The type of access required.
.It Fa cred
The user credentials to check.
@@ -57,8 +57,8 @@ The thread which is checking.
.El
.Pp
The
-.Fa mode
-is a mask which can contain
+.Fa accmode
+is a mask which can contain flags described in <sys/vnode.h>, e.g.
.Dv VREAD ,
.Dv VWRITE
or
@@ -71,7 +71,7 @@ otherwise an appropriate error code is returned.
.Sh PSEUDOCODE
.Bd -literal
int
-vop_access(struct vnode *vp, int mode, struct ucred *cred, struct thread *td)
+vop_access(struct vnode *vp, accmode_t accmode, struct ucred *cred, struct thread *td)
{
int error;
@@ -80,7 +80,7 @@ vop_access(struct vnode *vp, int mode, struct ucred *cred, struct thread *td)
* unless the file is a socket, fifo, or a block or
* character device resident on the filesystem.
*/
- if (mode & VWRITE) {
+ if (accmode & VWRITE) {
switch (vp->v_type) {
case VDIR:
case VLNK:
@@ -93,7 +93,7 @@ vop_access(struct vnode *vp, int mode, struct ucred *cred, struct thread *td)
}
/* If immutable bit set, nobody gets to write it. */
- if ((mode & VWRITE) && vp has immutable bit set)
+ if ((accmode & VWRITE) && vp has immutable bit set)
return EPERM;
/* Otherwise, user id 0 always gets access. */
@@ -104,11 +104,11 @@ vop_access(struct vnode *vp, int mode, struct ucred *cred, struct thread *td)
/* Otherwise, check the owner. */
if (cred->cr_uid == owner of vp) {
- if (mode & VEXEC)
+ if (accmode & VEXEC)
mask |= S_IXUSR;
- if (mode & VREAD)
+ if (accmode & VREAD)
mask |= S_IRUSR;
- if (mode & VWRITE)
+ if (accmode & VWRITE)
mask |= S_IWUSR;
return (((mode of vp) & mask) == mask ? 0 : EACCES);
}
@@ -116,21 +116,21 @@ vop_access(struct vnode *vp, int mode, struct ucred *cred, struct thread *td)
/* Otherwise, check the groups. */
for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++)
if (group of vp == *gp) {
- if (mode & VEXEC)
+ if (accmode & VEXEC)
mask |= S_IXGRP;
- if (mode & VREAD)
+ if (accmode & VREAD)
mask |= S_IRGRP;
- if (mode & VWRITE)
+ if (accmode & VWRITE)
mask |= S_IWGRP;
return (((mode of vp) & mask) == mask ? 0 : EACCES);
}
/* Otherwise, check everyone else. */
- if (mode & VEXEC)
+ if (accmode & VEXEC)
mask |= S_IXOTH;
- if (mode & VREAD)
+ if (accmode & VREAD)
mask |= S_IROTH;
- if (mode & VWRITE)
+ if (accmode & VWRITE)
mask |= S_IWOTH;
return (((mode of vp) & mask) == mask ? 0 : EACCES);
}
OpenPOWER on IntegriCloud