if (flags & ISDOTDOT)
VOP_UNLOCK(dvp, 0, p);
AFS_GLOCK();
- error = afs_lookup((struct vcache *)dvp, name, &vcp, cnp->cn_cred);
+ error = afs_lookup(VTOAFS(dvp), name, &vcp, cnp->cn_cred);
AFS_GUNLOCK();
if (error) {
if (flags & ISDOTDOT)
*ap->a_vpp = 0;
return (error);
}
- vp = (struct vnode *)vcp; /* always get a node if no error */
+ vp = AFSTOV(vcp); /* always get a node if no error */
/* The parent directory comes in locked. We unlock it on return
unless the caller wants it left locked.
p=cnp->cn_proc;
AFS_GLOCK();
- error = afs_create((struct vcache *)dvp, name, ap->a_vap, ap->a_vap->va_vaflags & VA_EXCLUSIVE? EXCL : NONEXCL,
+ error = afs_create(VTOAFS(dvp), name, ap->a_vap, ap->a_vap->va_vaflags & VA_EXCLUSIVE? EXCL : NONEXCL,
ap->a_vap->va_mode, &vcp,
cnp->cn_cred);
AFS_GUNLOCK();
}
if (vcp) {
- *ap->a_vpp = (struct vnode *)vcp;
- vn_lock((struct vnode *)vcp, LK_EXCLUSIVE| LK_RETRY, p);
+ *ap->a_vpp = AFSTOV(vcp);
+ vn_lock(AFSTOV(vcp), LK_EXCLUSIVE| LK_RETRY, p);
}
else *ap->a_vpp = 0;
{
int error;
int bad;
- struct vcache *vc = (struct vcache *)ap->a_vp;
+ struct vcache *vc = VTOAFS(ap->a_vp);
bad=0;
AFS_GLOCK();
error = afs_open(&vc, ap->a_mode, ap->a_cred);
#ifdef DIAGNOSTIC
- if ((struct vnode *)vc != ap->a_vp)
+ if (AFSTOV(vc) != ap->a_vp)
panic("AFS open changed vnode!");
#endif
afs_BozonLock(&vc->pvnLock, vc);
{
int code;
AFS_GLOCK();
- code=afs_access((struct vcache *)ap->a_vp, ap->a_mode, ap->a_cred);
+ code=afs_access(VTOAFS(ap->a_vp), ap->a_mode, ap->a_cred);
AFS_GUNLOCK();
return code;
}
{
int code;
AFS_GLOCK();
- code=afs_getattr((struct vcache *)ap->a_vp, ap->a_vap, ap->a_cred);
+ code=afs_getattr(VTOAFS(ap->a_vp), ap->a_vap, ap->a_cred);
AFS_GUNLOCK();
return code;
}
{
int code;
AFS_GLOCK();
- code=afs_setattr((struct vcache *)ap->a_vp, ap->a_vap, ap->a_cred);
+ code=afs_setattr(VTOAFS(ap->a_vp), ap->a_vap, ap->a_cred);
AFS_GUNLOCK();
return code;
}int
} */ *ap;
{
int code;
- struct vcache *avc=(struct vcache *)ap->a_vp;
+ struct vcache *avc=VTOAFS(ap->a_vp);
AFS_GLOCK();
afs_BozonLock(&avc->pvnLock, avc);
osi_FlushPages(avc); /* hold bozon lock, but not basic vnode lock */
struct iovec iov;
struct buf *bp;
vm_offset_t kva;
- struct vcache *avc=(struct vcache *)ap->a_vp;
+ struct vcache *avc=VTOAFS(ap->a_vp);
if (avc->v.v_object == NULL) {
printf("afs_getpages: called with non-merged cache vnode??\n");
} */ *ap;
{
int code;
- struct vcache *avc=(struct vcache *)ap->a_vp;
+ struct vcache *avc=VTOAFS(ap->a_vp);
AFS_GLOCK();
afs_BozonLock(&avc->pvnLock, avc);
osi_FlushPages(avc); /* hold bozon lock, but not basic vnode lock */
- code=afs_write((struct vcache *)ap->a_vp, ap->a_uio, ap->a_ioflag, ap->a_cred, 0);
+ code=afs_write(VTOAFS(ap->a_vp), ap->a_uio, ap->a_ioflag, ap->a_cred, 0);
afs_BozonUnlock(&avc->pvnLock, avc);
AFS_GUNLOCK();
return code;
struct iovec iov;
struct buf *bp;
vm_offset_t kva;
- struct vcache *avc=(struct vcache *)ap->a_vp;
+ struct vcache *avc=VTOAFS(ap->a_vp);
if (avc->v.v_object == NULL) {
printf("afs_putpages: called with non-merged cache vnode??\n");
struct proc *a_p;
} */ *ap;
{
- struct vcache *tvc = (struct vcache *)ap->a_vp;
+ struct vcache *tvc = VTOAFS(ap->a_vp);
struct afs_ioctl data;
int error = 0;
AFS_GLOCK();
/*vflushbuf(vp, wait);*/
if (ap->a_cred)
- error=afs_fsync((struct vcache *)vp, ap->a_cred);
+ error=afs_fsync(VTOAFS(vp), ap->a_cred);
else
- error=afs_fsync((struct vcache *)vp, &afs_osi_cred);
+ error=afs_fsync(VTOAFS(vp), &afs_osi_cred);
AFS_GUNLOCK();
return error;
}
GETNAME();
AFS_GLOCK();
- error = afs_remove((struct vcache *)dvp, name, cnp->cn_cred);
+ error = afs_remove(VTOAFS(dvp), name, cnp->cn_cred);
AFS_GUNLOCK();
cache_purge(vp);
DROPNAME();
goto out;
}
AFS_GLOCK();
- error = afs_link((struct vcache *)vp, (struct vcache *)dvp, name, cnp->cn_cred);
+ error = afs_link(VTOAFS(vp), VTOAFS(dvp), name, cnp->cn_cred);
AFS_GUNLOCK();
if (dvp != vp)
VOP_UNLOCK(vp,0, p);
AFS_GLOCK();
/* XXX use "from" or "to" creds? NFS uses "to" creds */
- error = afs_rename((struct vcache *)fdvp, fname, (struct vcache *)tdvp, tname, tcnp->cn_cred);
+ error = afs_rename(VTOAFS(fdvp), fname, VTOAFS(tdvp), tname, tcnp->cn_cred);
AFS_GUNLOCK();
FREE(fname, M_TEMP);
panic("afs_vop_mkdir: no name");
#endif
AFS_GLOCK();
- error = afs_mkdir((struct vcache *)dvp, name, vap, &vcp, cnp->cn_cred);
+ error = afs_mkdir(VTOAFS(dvp), name, vap, &vcp, cnp->cn_cred);
AFS_GUNLOCK();
if (error) {
vput(dvp);
return(error);
}
if (vcp) {
- *ap->a_vpp = (struct vnode *)vcp;
- vn_lock((struct vnode *)vcp, LK_EXCLUSIVE|LK_RETRY, p);
+ *ap->a_vpp = AFSTOV(vcp);
+ vn_lock(AFSTOV(vcp), LK_EXCLUSIVE|LK_RETRY, p);
} else
*ap->a_vpp = 0;
DROPNAME();
GETNAME();
AFS_GLOCK();
- error = afs_rmdir((struct vcache *)dvp, name, cnp->cn_cred);
+ error = afs_rmdir(VTOAFS(dvp), name, cnp->cn_cred);
AFS_GUNLOCK();
DROPNAME();
return error;
GETNAME();
AFS_GLOCK();
- error = afs_symlink((struct vcache *)dvp, name, ap->a_vap, ap->a_target,
+ error = afs_symlink(VTOAFS(dvp), name, ap->a_vap, ap->a_target,
cnp->cn_cred);
AFS_GUNLOCK();
DROPNAME();
ap->a_ncookies); */
off=ap->a_uio->uio_offset;
AFS_GLOCK();
- error= afs_readdir((struct vcache *)ap->a_vp, ap->a_uio, ap->a_cred,
+ error= afs_readdir(VTOAFS(ap->a_vp), ap->a_uio, ap->a_cred,
ap->a_eofflag);
AFS_GUNLOCK();
if (!error && ap->a_ncookies != NULL) {
int error;
/* printf("readlink %x\n", ap->a_vp);*/
AFS_GLOCK();
- error= afs_readlink((struct vcache *)ap->a_vp, ap->a_uio, ap->a_cred);
+ error= afs_readlink(VTOAFS(ap->a_vp), ap->a_uio, ap->a_cred);
AFS_GUNLOCK();
return error;
}
vprint("afs_vop_inactive(): pushing active", vp);
AFS_GLOCK();
- afs_InactiveVCache((struct vcache *)vp, 0); /* decrs ref counts */
+ afs_InactiveVCache(VTOAFS(vp), 0); /* decrs ref counts */
AFS_GUNLOCK();
VOP_UNLOCK(vp, 0, ap->a_p);
return 0;
#if 0
AFS_GLOCK();
- error = afs_FlushVCache((struct vcache *)vp, &sl); /* tosses our stuff from vnode */
+ error = afs_FlushVCache(VTOAFS(vp), &sl); /* tosses our stuff from vnode */
AFS_GUNLOCK();
ubc_unlink(vp);
if (!error && vp->v_data)
} */ *ap;
{
register struct vnode *vp = ap->a_vp;
- register struct vcache *avc = (struct vcache *)vp;
+ register struct vcache *avc = VTOAFS(vp);
if (vp->v_tag == VT_NON)
return (ENOENT);
} */ *ap;
{
struct vnode *vp = ap->a_vp;
- struct vcache *avc = (struct vcache *)vp;
+ struct vcache *avc = VTOAFS(vp);
return (lockmgr(&avc->rwlock, ap->a_flags | LK_RELEASE,
&vp->v_interlock, ap->a_p));
} */ *ap;
{
register struct vnode *vp = ap->a_vp;
- register struct vcache *vc = (struct vcache *)ap->a_vp;
+ register struct vcache *vc = VTOAFS(ap->a_vp);
int s = vc->states;
printf("tag %d, fid: %ld.%x.%x.%x, opens %d, writers %d", vp->v_tag, vc->fid.Cell,
vc->fid.Fid.Volume, vc->fid.Fid.Vnode, vc->fid.Fid.Unique, vc->opens,
struct vnode *a_vp;
} */ *ap;
{
- struct vcache *vc = (struct vcache *)ap->a_vp;
+ struct vcache *vc = VTOAFS(ap->a_vp);
return lockstatus(&vc->rwlock, ap->a_p);
}
struct ucred cr;
cr=*p->p_cred->pc_ucred;
AFS_GLOCK();
- error= afs_lockctl((struct vcache *)ap->a_vp, ap->a_fl, ap->a_op, &cr,
+ error= afs_lockctl(VTOAFS(ap->a_vp), ap->a_fl, ap->a_op, &cr,
(int) ap->a_id);
AFS_GUNLOCK();
return error;