/* RETURNS: 0 for successful copy to inline area; -1 if area not available  */
static int ea_write_inline(struct inode *ip, struct jfs_ea_list *ealist, int size, dxd_t *ea)
/* RETURNS: 0 for successful copy to inline area; -1 if area not available  */
static int ea_write_inline(struct inode *ip, struct jfs_ea_list *ealist, int size, dxd_t *ea)
{
	struct jfs_inode_info *ji = JFS_IP(ip);
	if (ealist && size > sizeof (struct jfs_ea_list)) {
		assert(size <= sizeof (ji->i_inline_ea));
		if (!(ji->mode2 & INLINEEA) && !(ji->ea.flag & DXD_INLINE))
			return -EPERM;
		DXDsize(ea, size);
		DXDlength(ea, 0);
		DXDaddress(ea, 0);
		memcpy(ji->i_inline_ea, ealist, size);
		ea->flag = DXD_INLINE;
		ji->mode2 &= ~INLINEEA;
	} else {
		ea->flag = 0;
		DXDsize(ea, 0);
		DXDlength(ea, 0);
		DXDaddress(ea, 0);
		if (ji->ea.flag & DXD_INLINE)
			ji->mode2 |= INLINEEA;
	}
	return 0;
}