FreeBSD/sys/kern/vfs_extattr.c
/*
 * extattr_delete_vp(): Delete a named extended attribute on a file or
 *                      directory
 *
 * Arguments: unlocked vnode "vp", attribute namespace "attrnamespace",
 *            kernelspace string pointer "attrname", proc "p"
 * Returns: 0 on success, an error number otherwise
 * Locks: none
 * References: vp must be a valid reference for the duration of the call
 */
Delete a named extended attribute on a file or
directory


Delete a named extended attribute on a file or directory
static int
extattr_delete_vp(struct vnode *vp, int attrnamespace, const char *attrname,
    struct thread *td)
{
	struct mount *mp;
	int error;
	error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
	if (error)
		return (error);
	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
#ifdef MAC
	error = mac_vnode_check_deleteextattr(td->td_ucred, vp, attrnamespace,
	    attrname);
	if (error)
		goto done;
#endif
	error = VOP_DELETEEXTATTR(vp, attrnamespace, attrname, td->td_ucred,
	    td);
	if (error == EOPNOTSUPP)
		error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL,
		    td->td_ucred, td);
#ifdef MAC
done:
#endif
	VOP_UNLOCK(vp, 0);
	vn_finished_write(mp);
	return (error);
}
static int extattr_delete_vp ( struct vnode * vp , int attrnamespace , const char * attrname , struct thread * td ) { struct mount * mp ; int error ; error = vn_start_write ( vp , & mp , V_WAIT | PCATCH ) ; if ( error ) return ( error ) ; vn_lock ( vp , LK_EXCLUSIVE | LK_RETRY ) ; #ifdef MAC error = mac_vnode_check_deleteextattr ( td -> td_ucred , vp , attrnamespace , attrname ) ; if ( error ) goto done ; #endif error = VOP_DELETEEXTATTR ( vp , attrnamespace , attrname , td -> td_ucred , td ) ; if ( error == EOPNOTSUPP ) error = VOP_SETEXTATTR ( vp , attrnamespace , attrname , NULL , td -> td_ucred , td ) ; #ifdef MAC done : #endif VOP_UNLOCK ( vp , 0 ) ; vn_finished_write ( mp ) ; return ( error ) ; }
extattr_delete_vp(): Delete a named extended attribute on a file or
                      directory
extattr_delete_vp () : Delete a named extended attribute on a file or directory