static void nfsrv_object_create(struct vnode *vp, struct thread *td) { if (vp == NULL || vp->v_type != VREG) return; (void) vfs_object_create(vp, td, td->td_ucred); }
/* * Enable an EA using the passed file system, backing vnode, attribute name, * namespace, and proc. Will perform a VOP_OPEN() on the vp, so expects vp * to be locked when passed in. The vnode will be returned unlocked, * regardless of success/failure of the function. As a result, the caller * will always need to vrele(), but not vput(). */ static int ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp, int attrnamespace, const char *attrname, struct proc *p) { int error; error = VOP_OPEN(vp, FREAD|FWRITE, p->p_ucred, p); if (error) { printf("ufs_extattr_enable_with_open.VOP_OPEN(): failed " "with %d\n", error); VOP_UNLOCK(vp, 0, p); return (error); } #if 0 /* - XXX */ /* * XXX: Note, should VOP_CLOSE() if vfs_object_create() fails, but due * to a similar piece of code in vn_open(), we don't. */ if (vn_canvmio(vp) == TRUE) if ((error = vfs_object_create(vp, p, p->p_ucred)) != 0) { /* * XXX: bug replicated from vn_open(): should * VOP_CLOSE() here. */ VOP_UNLOCK(vp, 0, p); return (error); } #endif vp->v_writecount++; vref(vp); VOP_UNLOCK(vp, 0, p); error = ufs_extattr_enable(ump, attrnamespace, attrname, vp, p); if (error != 0) vn_close(vp, FREAD|FWRITE, p->p_ucred, p); return (error); }