/* * Get the change attribute from visible and returns TRUE. * If the change value is not available returns FALSE. */ bool_t nfs_visible_change(struct exportinfo *exi, vnode_t *vp, timespec_t *change) { struct exp_visible *visp; fid_t fid; treenode_t *node; /* * First check to see if vp is export root. */ if (VN_CMP(vp, exi->exi_vp)) goto exproot; /* * Only a PSEUDO node has a visible list or an exported VROOT * node may have a visible list. */ if (!PSEUDO(exi)) exi = get_root_export(exi); /* Get the fid of the vnode */ bzero(&fid, sizeof (fid)); fid.fid_len = MAXFIDSZ; if (vop_fid_pseudo(vp, &fid) != 0) return (FALSE); /* * We can't trust VN_CMP() above because of LOFS. * Even though VOP_CMP will do the right thing for LOFS * objects, VN_CMP will short circuit out early when the * vnode ops ptrs are different. Just in case we're dealing * with LOFS, compare exi_fid/fsid here. */ if (EQFID(&exi->exi_fid, &fid) && EQFSID(&exi->exi_fsid, &vp->v_vfsp->vfs_fsid)) goto exproot; /* See if it matches any fid in the visible list */ for (visp = exi->exi_visible; visp; visp = visp->vis_next) { if (EQFID(&fid, &visp->vis_fid)) { *change = visp->vis_change; return (TRUE); } } return (FALSE); exproot: /* The VROOT export have its visible available through treenode */ node = exi->exi_tree; if (node != ns_root) { ASSERT(node->tree_vis != NULL); *change = node->tree_vis->vis_change; } else { ASSERT(node->tree_vis == NULL); *change = ns_root_change; } return (TRUE); }
/* * Returns true if the supplied vnode is the * directory of an export point. */ int nfs_exported(struct exportinfo *exi, vnode_t *vp) { struct exp_visible *visp; fid_t fid; /* * First check to see if vp is the export root * This check required for the case of lookup .. * where .. is a V_ROOT vnode and a pseudo exportroot. * Pseudo export root objects do not have an entry * in the visible list even though every V_ROOT * pseudonode is visible. It is safe to compare * vp here because pseudo_exportfs put a hold on * it when exi_vp was initialized. * * Note: VN_CMP() won't match for LOFS shares, but they're * handled below w/EQFID/EQFSID. */ if (VN_CMP(vp, exi->exi_vp)) return (1); /* Get the fid of the vnode */ bzero(&fid, sizeof (fid)); fid.fid_len = MAXFIDSZ; if (vop_fid_pseudo(vp, &fid) != 0) return (0); if (EQFID(&fid, &exi->exi_fid) && EQFSID(&vp->v_vfsp->vfs_fsid, &exi->exi_fsid)) { return (1); } /* See if it matches any fid in the visible list */ for (visp = exi->exi_visible; visp; visp = visp->vis_next) { if (EQFID(&fid, &visp->vis_fid)) return (visp->vis_exported); } return (0); }
/* * Returns true if the supplied vnode is visible * in this export. If vnode is visible, return * vis_exported in expseudo. */ int nfs_visible(struct exportinfo *exi, vnode_t *vp, int *expseudo) { struct exp_visible *visp; fid_t fid; /* * First check to see if vp is export root. * * A pseudo export root can never be exported * (it would be a real export then); however, * it is always visible. If a pseudo root object * was exported by server admin, then the entire * pseudo exportinfo (and all visible entries) would * be destroyed. A pseudo exportinfo only exists * to provide access to real (descendant) export(s). * * Previously, rootdir was special cased here; however, * the export root special case handles the rootdir * case also. */ if (VN_CMP(vp, exi->exi_vp)) { *expseudo = 0; return (1); } /* * Only a PSEUDO node has a visible list or an exported VROOT * node may have a visible list. */ if (! PSEUDO(exi)) exi = get_root_export(exi); /* Get the fid of the vnode */ bzero(&fid, sizeof (fid)); fid.fid_len = MAXFIDSZ; if (vop_fid_pseudo(vp, &fid) != 0) { *expseudo = 0; return (0); } /* * We can't trust VN_CMP() above because of LOFS. * Even though VOP_CMP will do the right thing for LOFS * objects, VN_CMP will short circuit out early when the * vnode ops ptrs are different. Just in case we're dealing * with LOFS, compare exi_fid/fsid here. * * expseudo is not set because this is not an export */ if (EQFID(&exi->exi_fid, &fid) && EQFSID(&exi->exi_fsid, &vp->v_vfsp->vfs_fsid)) { *expseudo = 0; return (1); } /* See if it matches any fid in the visible list */ for (visp = exi->exi_visible; visp; visp = visp->vis_next) { if (EQFID(&fid, &visp->vis_fid)) { *expseudo = visp->vis_exported; return (1); } } *expseudo = 0; return (0); }