FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
/*
 * Vnode operation to remove a named attribute.
 */
Vnode operation to remove a named attribute.
Vnode operation to remove a named attribute .
int
zfs_deleteextattr(struct vop_deleteextattr_args *ap)
{
	zfsvfs_t *zfsvfs = VTOZ(ap->a_vp)->z_zfsvfs;
	struct thread *td = ap->a_td;
	struct nameidata nd;
	char attrname[255];
	struct vattr va;
	vnode_t *xvp = NULL, *vp;
	int error, flags;
	error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace,
	    ap->a_cred, ap->a_td, VWRITE);
	if (error != 0)
		return (error);
	error = zfs_create_attrname(ap->a_attrnamespace, ap->a_name, attrname,
	    sizeof(attrname));
	if (error != 0)
		return (error);
	ZFS_ENTER(zfsvfs);
	error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
	    LOOKUP_XATTR);
	if (error != 0) {
		ZFS_EXIT(zfsvfs);
		return (error);
	}
	NDINIT_ATVP(&nd, DELETE, NOFOLLOW | LOCKPARENT | LOCKLEAF,
	    UIO_SYSSPACE, attrname, xvp, td);
	error = namei(&nd);
	vp = nd.ni_vp;
	if (error != 0) {
		ZFS_EXIT(zfsvfs);
		NDFREE(&nd, NDF_ONLY_PNBUF);
		if (error == ENOENT)
			error = ENOATTR;
		return (error);
	}
	error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd);
	NDFREE(&nd, NDF_ONLY_PNBUF);
	vput(nd.ni_dvp);
	if (vp == nd.ni_dvp)
		vrele(vp);
	else
		vput(vp);
	ZFS_EXIT(zfsvfs);
	return (error);
}
int zfs_deleteextattr ( struct vop_deleteextattr_args * ap ) { zfsvfs_t * zfsvfs = VTOZ ( ap -> a_vp ) -> z_zfsvfs ; struct thread * td = ap -> a_td ; struct nameidata nd ; char attrname [ 255 ] ; struct vattr va ; vnode_t * xvp = NULL , * vp ; int error , flags ; error = extattr_check_cred ( ap -> a_vp , ap -> a_attrnamespace , ap -> a_cred , ap -> a_td , VWRITE ) ; if ( error != 0 ) return ( error ) ; error = zfs_create_attrname ( ap -> a_attrnamespace , ap -> a_name , attrname , sizeof ( attrname ) ) ; if ( error != 0 ) return ( error ) ; ZFS_ENTER ( zfsvfs ) ; error = zfs_lookup ( ap -> a_vp , NULL , & xvp , NULL , 0 , ap -> a_cred , td , LOOKUP_XATTR ) ; if ( error != 0 ) { ZFS_EXIT ( zfsvfs ) ; return ( error ) ; } NDINIT_ATVP ( & nd , DELETE , NOFOLLOW | LOCKPARENT | LOCKLEAF , UIO_SYSSPACE , attrname , xvp , td ) ; error = namei ( & nd ) ; vp = nd . ni_vp ; if ( error != 0 ) { ZFS_EXIT ( zfsvfs ) ; NDFREE ( & nd , NDF_ONLY_PNBUF ) ; if ( error == ENOENT ) error = ENOATTR ; return ( error ) ; } error = VOP_REMOVE ( nd . ni_dvp , vp , & nd . ni_cnd ) ; NDFREE ( & nd , NDF_ONLY_PNBUF ) ; vput ( nd . ni_dvp ) ; if ( vp == nd . ni_dvp ) vrele ( vp ) ; else vput ( vp ) ; ZFS_EXIT ( zfsvfs ) ; return ( error ) ; }
Vnode operation to remove a named attribute.
Vnode operation to remove a named attribute .
/*
vop_deleteextattr {
	IN struct vnode *a_vp;
	IN int a_attrnamespace;
	IN const char *a_name;
	IN struct ucred *a_cred;
	IN struct thread *a_td;
};
*/