Commit 4a1f2f38 authored by Al Viro's avatar Al Viro

ubi/cdev: switch to fixed_size_llseek()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 54de90d6
...@@ -155,7 +155,6 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin) ...@@ -155,7 +155,6 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
{ {
struct ubi_volume_desc *desc = file->private_data; struct ubi_volume_desc *desc = file->private_data;
struct ubi_volume *vol = desc->vol; struct ubi_volume *vol = desc->vol;
loff_t new_offset;
if (vol->updating) { if (vol->updating) {
/* Update is in progress, seeking is prohibited */ /* Update is in progress, seeking is prohibited */
...@@ -163,30 +162,7 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin) ...@@ -163,30 +162,7 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
return -EBUSY; return -EBUSY;
} }
switch (origin) { return fixed_size_llseek(file, offset, origin, vol->used_bytes);
case 0: /* SEEK_SET */
new_offset = offset;
break;
case 1: /* SEEK_CUR */
new_offset = file->f_pos + offset;
break;
case 2: /* SEEK_END */
new_offset = vol->used_bytes + offset;
break;
default:
return -EINVAL;
}
if (new_offset < 0 || new_offset > vol->used_bytes) {
ubi_err("bad seek %lld", new_offset);
return -EINVAL;
}
dbg_gen("seek volume %d, offset %lld, origin %d, new offset %lld",
vol->vol_id, offset, origin, new_offset);
file->f_pos = new_offset;
return new_offset;
} }
static int vol_cdev_fsync(struct file *file, loff_t start, loff_t end, static int vol_cdev_fsync(struct file *file, loff_t start, loff_t end,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment