Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186796
b: refs/heads/master
c: 877de4b
h: refs/heads/master
v: v3
  • Loading branch information
Arthur Benilov authored and Greg Kroah-Hartman committed Mar 4, 2010
1 parent dcd605d commit bbb6cd9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bb9ea89ec8a3d80a835d53afc388ad5f67fd3cb3
refs/heads/master: 877de4b4866f1cc0a25a4d67d3927304556f5d1f
35 changes: 33 additions & 2 deletions trunk/drivers/staging/vme/devices/vme_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,39 @@ static ssize_t vme_user_write(struct file *file, const char *buf, size_t count,

static loff_t vme_user_llseek(struct file *file, loff_t off, int whence)
{
printk(KERN_ERR "Llseek currently incomplete\n");
return -EINVAL;
loff_t absolute = -1;
unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev);
size_t image_size;

down(&image[minor].sem);
image_size = vme_get_size(image[minor].resource);

switch (whence) {
case SEEK_SET:
absolute = off;
break;
case SEEK_CUR:
absolute = file->f_pos + off;
break;
case SEEK_END:
absolute = image_size + off;
break;
default:
up(&image[minor].sem);
return -EINVAL;
break;
}

if ((absolute < 0) || (absolute >= image_size)) {
up(&image[minor].sem);
return -EINVAL;
}

file->f_pos = absolute;

up(&image[minor].sem);

return absolute;
}

/*
Expand Down

0 comments on commit bbb6cd9

Please sign in to comment.