You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
new helpers: no_seek_end_llseek{,_size}()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
+1
-30
@@ -277,36 +277,7 @@ static loff_t flash_llseek(struct file *file, loff_t offset, int orig)
|
||||
printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n",
|
||||
(unsigned int) offset, orig);
|
||||
|
||||
switch (orig) {
|
||||
case 0:
|
||||
if (offset < 0) {
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((unsigned int) offset > gbFlashSize) {
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
file->f_pos = (unsigned int) offset;
|
||||
ret = file->f_pos;
|
||||
break;
|
||||
case 1:
|
||||
if ((file->f_pos + offset) > gbFlashSize) {
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if ((file->f_pos + offset) < 0) {
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
file->f_pos += offset;
|
||||
ret = file->f_pos;
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
}
|
||||
ret = no_seek_end_llseek_size(file, offset, orig, gbFlashSize);
|
||||
mutex_unlock(&flash_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user