FreeBSD/sys/ufs/ufs/ufs_extattr.c
/*
 * Enable an EA using the passed filesystem, 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().
 */
Enable an EA using the passed filesystem, 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().
Enable an EA using the passed filesystem 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 thread *td)
{
	int error;
	error = VOP_OPEN(vp, FREAD|FWRITE, td->td_ucred, td, NULL);
	if (error) {
		printf("ufs_extattr_enable_with_open.VOP_OPEN(): failed "
		    "with %d\n", error);
		VOP_UNLOCK(vp, 0);
		return (error);
	}
	VOP_ADD_WRITECOUNT(vp, 1);
	CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", __func__, vp,
	    vp->v_writecount);
	vref(vp);
	VOP_UNLOCK(vp, 0);
	error = ufs_extattr_enable(ump, attrnamespace, attrname, vp, td);
	if (error != 0)
		vn_close(vp, FREAD|FWRITE, td->td_ucred, td);
	return (error);
}
static int ufs_extattr_enable_with_open ( struct ufsmount * ump , struct vnode * vp , int attrnamespace , const char * attrname , struct thread * td ) { int error ; error = VOP_OPEN ( vp , FREAD | FWRITE , td -> td_ucred , td , NULL ) ; if ( error ) { printf ( " " " \n " , error ) ; VOP_UNLOCK ( vp , 0 ) ; return ( error ) ; } VOP_ADD_WRITECOUNT ( vp , 1 ) ; CTR3 ( KTR_VFS , " " , __func__ , vp , vp -> v_writecount ) ; vref ( vp ) ; VOP_UNLOCK ( vp , 0 ) ; error = ufs_extattr_enable ( ump , attrnamespace , attrname , vp , td ) ; if ( error != 0 ) vn_close ( vp , FREAD | FWRITE , td -> td_ucred , td ) ; return ( error ) ; }
Enable an EA using the passed filesystem, backing vnode, attribute name,
 namespace, and proc.
Enable an EA using the passed filesystem backing vnode attribute name namespace and proc .