dev_t VnodeToDev(vnode_t avp) { #ifndef AFS_DARWIN80_ENV if (afs_CacheFSType == AFS_APPL_UFS_CACHE) { struct inode *ip = VTOI(avp); return ip->i_dev; } else if (afs_CacheFSType == AFS_APPL_HFS_CACHE) { #endif #if defined(AFS_DARWIN80_ENV) struct vattr va; VATTR_INIT(&va); VATTR_WANTED(&va, va_fsid); if (vnode_getattr(avp, &va, afs_osi_ctxtp)) osi_Panic("VOP_GETATTR failed in VnodeToDev\n"); if (!VATTR_ALL_SUPPORTED(&va)) osi_Panic("VOP_GETATTR unsupported fsid in VnodeToIno\n"); return va.va_fsid; /* XXX they say it's the dev.... */ #elif !defined(VTOH) struct vattr va; if (VOP_GETATTR(avp, &va, &afs_osi_cred, current_proc())) osi_Panic("VOP_GETATTR failed in VnodeToDev\n"); return va.va_fsid; /* XXX they say it's the dev.... */ #else struct hfsnode *hp = VTOH(avp); return H_DEV(hp); #endif #ifndef AFS_DARWIN80_ENV } else osi_Panic("VnodeToDev called before cacheops initialized\n"); #endif }
ino_t VnodeToIno(vnode_t avp) { unsigned long ret; #ifndef AFS_DARWIN80_ENV if (afs_CacheFSType == AFS_APPL_UFS_CACHE) { struct inode *ip = VTOI(avp); ret = ip->i_number; } else if (afs_CacheFSType == AFS_APPL_HFS_CACHE) { #endif #if defined(AFS_DARWIN80_ENV) struct vattr va; VATTR_INIT(&va); VATTR_WANTED(&va, va_fileid); if (vnode_getattr(avp, &va, afs_osi_ctxtp)) osi_Panic("VOP_GETATTR failed in VnodeToIno\n"); if (!VATTR_ALL_SUPPORTED(&va)) osi_Panic("VOP_GETATTR unsupported fileid in VnodeToIno\n"); ret = va.va_fileid; #elif !defined(VTOH) struct vattr va; if (VOP_GETATTR(avp, &va, &afs_osi_cred, current_proc())) osi_Panic("VOP_GETATTR failed in VnodeToIno\n"); ret = va.va_fileid; #else struct hfsnode *hp = VTOH(avp); ret = H_FILEID(hp); #endif #ifndef AFS_DARWIN80_ENV } else osi_Panic("VnodeToIno called before cacheops initialized\n"); #endif return ret; }
osi_DisableAtimes(struct vnode *avp) #endif { #ifdef AFS_DARWIN80_ENV struct vnode_attr vap; VATTR_INIT(&vap); VATTR_CLEAR_SUPPORTED(&vap, va_access_time); vnode_setattr(avp, &vap, afs_osi_ctxtp); #else if (afs_CacheFSType == AFS_APPL_UFS_CACHE) { struct inode *ip = VTOI(avp); ip->i_flag &= ~IN_ACCESS; } #ifdef VTOH /* can't do this without internals */ else if (afs_CacheFSType == AFS_APPL_HFS_CACHE) { struct hfsnode *hp = VTOH(avp); hp->h_nodeflags &= ~IN_ACCESS; } #endif #endif }
/* * Initialize the vnode associated with a new hfsnode. */ void hfs_vinit(struct mount *mp, int (**specops)(void *), int (**fifoops)(void *), struct vnode **vpp) { struct hfsnode *hp; struct vnode *vp; vp = *vpp; hp = VTOH(vp); vp->v_type = hfs_catalog_keyed_record_vtype( (hfs_catalog_keyed_record_t *)&hp->h_rec); switch(vp->v_type) { case VCHR: case VBLK: vp->v_op = specops; spec_node_init(vp, HFS_CONVERT_RDEV(hp->h_rec.file.bsd.special.raw_device)); break; case VFIFO: vp->v_op = fifoops; break; case VNON: case VBAD: case VSOCK: case VDIR: case VREG: case VLNK: break; } if (hp->h_rec.u.cnid == HFS_CNID_ROOT_FOLDER) vp->v_vflag |= VV_ROOT; *vpp = vp; }