aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-06-23 04:30:24 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-29 04:57:49 -0400
commit4a1f2f386b0011782099b4393ee74370916b6aef (patch)
tree3336ee1e0d4a7ab52d08de219ac7eb46ea1031c9
parent54de90d686eacd4a761f7ce65c54f1eb3a159429 (diff)
ubi/cdev: switch to fixed_size_llseek()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/mtd/ubi/cdev.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 4f02848bb2bc..8ca49f2043e4 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -155,7 +155,6 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
155{ 155{
156 struct ubi_volume_desc *desc = file->private_data; 156 struct ubi_volume_desc *desc = file->private_data;
157 struct ubi_volume *vol = desc->vol; 157 struct ubi_volume *vol = desc->vol;
158 loff_t new_offset;
159 158
160 if (vol->updating) { 159 if (vol->updating) {
161 /* Update is in progress, seeking is prohibited */ 160 /* 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 return -EBUSY; 162 return -EBUSY;
164 } 163 }
165 164
166 switch (origin) { 165 return fixed_size_llseek(file, offset, origin, vol->used_bytes);
167 case 0: /* SEEK_SET */
168 new_offset = offset;
169 break;
170 case 1: /* SEEK_CUR */
171 new_offset = file->f_pos + offset;
172 break;
173 case 2: /* SEEK_END */
174 new_offset = vol->used_bytes + offset;
175 break;
176 default:
177 return -EINVAL;
178 }
179
180 if (new_offset < 0 || new_offset > vol->used_bytes) {
181 ubi_err("bad seek %lld", new_offset);
182 return -EINVAL;
183 }
184
185 dbg_gen("seek volume %d, offset %lld, origin %d, new offset %lld",
186 vol->vol_id, offset, origin, new_offset);
187
188 file->f_pos = new_offset;
189 return new_offset;
190} 166}
191 167
192static int vol_cdev_fsync(struct file *file, loff_t start, loff_t end, 168static int vol_cdev_fsync(struct file *file, loff_t start, loff_t end,