Beispiel #1
0
int compat_get_timeval(struct timeval *tv, const void __user *utv)
{
	if (COMPAT_USE_64BIT_TIME)
		return copy_from_user(tv, utv, sizeof *tv) ? -EFAULT : 0;
	else
		return get_compat_timeval(tv, utv);
}
long compat_get_hwcam_buf_status_data(hwcam_buf_status_t *kp, hwcam_buf_status_t32 __user *up)
{
	long ret = 0;

	ret  = get_user(kp->id, &up->id);
	ret |= get_user(kp->buf_status, &up->buf_status);
	ret |= get_compat_timeval(&kp->tv, &up->tv);

	return ret;
}
long compat_get_hwisp_stream_buf_info(hwisp_stream_buf_info_t *kp, hwisp_stream_buf_info_t32 __user *up)
{
	long ret = 0;

	ret  = get_user(kp->user_buffer_handle, &up->user_buffer_handle);
	ret |= get_user(kp->y_addr_phy, &up->y_addr_phy);
	ret |= get_user(kp->u_addr_phy, &up->u_addr_phy);
	ret |= get_user(kp->v_addr_phy, &up->v_addr_phy);
	ret |= get_user(kp->y_addr_iommu, &up->y_addr_iommu);
	ret |= get_user(kp->u_addr_iommu, &up->u_addr_iommu);
	ret |= get_user(kp->v_addr_iommu, &up->v_addr_iommu);
	ret |= get_user(kp->ion_fd, &up->ion_fd);
	ret |= get_user(kp->ion_vc_hdl, &up->ion_vc_hdl);
	ret |= get_user(kp->ion_vaddr, &up->ion_vaddr);
	ret |= get_compat_timeval(&kp->timestamp, &up->timestamp);
	ret |= copy_in_user(&kp->port, &up->port, sizeof(ovisp23_port_info_t));

	return ret;
}
long compat_get_hwcam_buf_status_data(hwcam_buf_status_t __user *pdata, hwcam_buf_status_t32 __user *pdata32)
{
	long ret = 0;
    compat_int_t id;
    compat_int_t status;
    struct timeval tv;

	if (!access_ok(VERIFY_READ, pdata32, sizeof(hwcam_buf_status_t32)))
	    return -EFAULT;

	ret  = get_user(id, &pdata32->id);
    ret |= put_user(id, &pdata->id);
	ret |= get_user(status, &pdata32->buf_status);
    ret |= put_user(status, &pdata->buf_status);
	ret |= get_compat_timeval(&tv, &pdata32->tv);
    /* ret |= put_compat_timeval(&tv, &pdata->tv); */
    ret |= copy_to_user(&pdata->tv, &tv, sizeof(tv));
	return ret;
}