FreeBSD/sys/ufs/ffs/ffs_vnops.c
/*
 * Vnode operation to retrieve a named extended attribute.
 */
Vnode operation to retrieve a named extended attribute.
Vnode operation to retrieve a named extended attribute .
static int
ffs_getextattr(struct vop_getextattr_args *ap)
{
	struct inode *ip;
	u_char *eae, *p;
	unsigned easize;
	int error, ealen;
	ip = VTOI(ap->a_vp);
	if (ap->a_vp->v_type == VCHR || ap->a_vp->v_type == VBLK)
		return (EOPNOTSUPP);
	error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace,
	    ap->a_cred, ap->a_td, VREAD);
	if (error)
		return (error);
	error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td);
	if (error)
		return (error);
	eae = ip->i_ea_area;
	easize = ip->i_ea_len;
	ealen = ffs_findextattr(eae, easize, ap->a_attrnamespace, ap->a_name,
	    NULL, &p);
	if (ealen >= 0) {
		error = 0;
		if (ap->a_size != NULL)
			*ap->a_size = ealen;
		else if (ap->a_uio != NULL)
			error = uiomove(p, ealen, ap->a_uio);
	} else
		error = ENOATTR;
	ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
	return(error);
}
static int ffs_getextattr ( struct vop_getextattr_args * ap ) { struct inode * ip ; u_char * eae , * p ; unsigned easize ; int error , ealen ; ip = VTOI ( ap -> a_vp ) ; if ( ap -> a_vp -> v_type == VCHR || ap -> a_vp -> v_type == VBLK ) return ( EOPNOTSUPP ) ; error = extattr_check_cred ( ap -> a_vp , ap -> a_attrnamespace , ap -> a_cred , ap -> a_td , VREAD ) ; if ( error ) return ( error ) ; error = ffs_open_ea ( ap -> a_vp , ap -> a_cred , ap -> a_td ) ; if ( error ) return ( error ) ; eae = ip -> i_ea_area ; easize = ip -> i_ea_len ; ealen = ffs_findextattr ( eae , easize , ap -> a_attrnamespace , ap -> a_name , NULL , & p ) ; if ( ealen >= 0 ) { error = 0 ; if ( ap -> a_size != NULL ) * ap -> a_size = ealen ; else if ( ap -> a_uio != NULL ) error = uiomove ( p , ealen , ap -> a_uio ) ; } else error = ENOATTR ; ffs_close_ea ( ap -> a_vp , 0 , ap -> a_cred , ap -> a_td ) ; return ( error ) ; }
Vnode operation to retrieve a named extended attribute.
Vnode operation to retrieve a named extended attribute .
/*
vop_getextattr {
	IN struct vnode *a_vp;
	IN int a_attrnamespace;
	IN const char *a_name;
	INOUT struct uio *a_uio;
	OUT size_t *a_size;
	IN struct ucred *a_cred;
	IN struct thread *a_td;
};
*/