/* We are going ot alloc a page during init per window for small transfers. Small transfers will go VME -> buffer -> user space. Larger (more than a page) transfers will lock the user space buffer into memory and then transfer the data directly into the user space buffers.  */
static ssize_t resource_to_user(int minor, char __user *buf, size_t count, loff_t *ppos)
/* We are going ot alloc a page during init per window for small transfers. Small transfers will go VME -> buffer -> user space. Larger (more than a page) transfers will lock the user space buffer into memory and then transfer the data directly into the user space buffers.  */
static ssize_t resource_to_user(int minor, char __user *buf, size_t count, loff_t *ppos)
{
	ssize_t retval;
	ssize_t copied = 0;
	if (count <= image[minor].size_buf) {
		copied = vme_master_read(image[minor].resource,
			image[minor].kern_buf, count, *ppos);
		if (copied < 0) {
			return (int)copied;
		}
		retval = __copy_to_user(buf, image[minor].kern_buf,
			(unsigned long)copied);
		if (retval != 0) {
			copied = (copied - retval);
			printk("User copy failed\n");
			return -EINVAL;
		}
	} else {
		printk("Currently don't support large transfers\n");
		return -EINVAL;
	}
	return copied;
}