summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_cache.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-06-21 19:21:01 +0000
committerkib <kib@FreeBSD.org>2009-06-21 19:21:01 +0000
commit2fc79768f33d575d200ae1482dc23207f9d93703 (patch)
tree16815288a4df4ec66279d1a1e04aabcdf84a88c9 /sys/kern/vfs_cache.c
parentb69e15d521bbb1550dc659223e33c2343e332269 (diff)
downloadFreeBSD-src-2fc79768f33d575d200ae1482dc23207f9d93703.zip
FreeBSD-src-2fc79768f33d575d200ae1482dc23207f9d93703.tar.gz
Add explicit struct ucred * argument for VOP_VPTOCNP, to be used by
vn_open_cred in default implementation. Valid struct ucred is needed for audit and MAC, and curthread credentials may be wrong. This further requires modifying the interface of vn_fullpath(9), but it is out of scope of this change. Reviewed by: rwatson
Diffstat (limited to 'sys/kern/vfs_cache.c')
-rw-r--r--sys/kern/vfs_cache.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 0bd7975..f21f4af 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -206,7 +206,8 @@ SYSCTL_OPAQUE(_vfs_cache, OID_AUTO, nchstats, CTLFLAG_RD | CTLFLAG_MPSAFE,
static void cache_zap(struct namecache *ncp);
-static int vn_vptocnp_locked(struct vnode **vp, char *buf, u_int *buflen);
+static int vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf,
+ u_int *buflen);
static int vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir,
char *buf, char **retbuf, u_int buflen);
@@ -1037,12 +1038,12 @@ vn_fullpath_global(struct thread *td, struct vnode *vn,
}
int
-vn_vptocnp(struct vnode **vp, char *buf, u_int *buflen)
+vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf, u_int *buflen)
{
int error;
CACHE_RLOCK();
- error = vn_vptocnp_locked(vp, buf, buflen);
+ error = vn_vptocnp_locked(vp, cred, buf, buflen);
if (error == 0) {
/*
* vn_vptocnp_locked() dropped hold acquired by
@@ -1057,7 +1058,8 @@ vn_vptocnp(struct vnode **vp, char *buf, u_int *buflen)
}
static int
-vn_vptocnp_locked(struct vnode **vp, char *buf, u_int *buflen)
+vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf,
+ u_int *buflen)
{
struct vnode *dvp;
struct namecache *ncp;
@@ -1089,7 +1091,7 @@ vn_vptocnp_locked(struct vnode **vp, char *buf, u_int *buflen)
CACHE_RUNLOCK();
vfslocked = VFS_LOCK_GIANT((*vp)->v_mount);
vn_lock(*vp, LK_SHARED | LK_RETRY);
- error = VOP_VPTOCNP(*vp, &dvp, buf, buflen);
+ error = VOP_VPTOCNP(*vp, &dvp, cred, buf, buflen);
VOP_UNLOCK(*vp, 0);
vdrop(*vp);
VFS_UNLOCK_GIANT(vfslocked);
@@ -1137,7 +1139,7 @@ vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir,
numfullpathcalls++;
CACHE_RLOCK();
if (vp->v_type != VDIR) {
- error = vn_vptocnp_locked(&vp, buf, &buflen);
+ error = vn_vptocnp_locked(&vp, td->td_ucred, buf, &buflen);
if (error)
return (error);
if (buflen == 0) {
@@ -1167,7 +1169,7 @@ vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir,
error, vp, NULL, 0, 0);
break;
}
- error = vn_vptocnp_locked(&vp, buf, &buflen);
+ error = vn_vptocnp_locked(&vp, td->td_ucred, buf, &buflen);
if (error)
break;
if (buflen == 0) {
OpenPOWER on IntegriCloud