mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
new helpers: no_seek_end_llseek{,_size}()
Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
b808b1d632
commit
b25472f9b9
13 changed files with 54 additions and 222 deletions
|
|
@ -782,24 +782,11 @@ static int ur_release(struct inode *inode, struct file *file)
|
|||
|
||||
static loff_t ur_llseek(struct file *file, loff_t offset, int whence)
|
||||
{
|
||||
loff_t newpos;
|
||||
|
||||
if ((file->f_flags & O_ACCMODE) != O_RDONLY)
|
||||
return -ESPIPE; /* seek allowed only for reader */
|
||||
if (offset % PAGE_SIZE)
|
||||
return -ESPIPE; /* only multiples of 4K allowed */
|
||||
switch (whence) {
|
||||
case 0: /* SEEK_SET */
|
||||
newpos = offset;
|
||||
break;
|
||||
case 1: /* SEEK_CUR */
|
||||
newpos = file->f_pos + offset;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
file->f_pos = newpos;
|
||||
return newpos;
|
||||
return no_seek_end_llseek(file, offset, whence);
|
||||
}
|
||||
|
||||
static const struct file_operations ur_fops = {
|
||||
|
|
|
|||
|
|
@ -385,18 +385,7 @@ static loff_t zcore_lseek(struct file *file, loff_t offset, int orig)
|
|||
loff_t rc;
|
||||
|
||||
mutex_lock(&zcore_mutex);
|
||||
switch (orig) {
|
||||
case 0:
|
||||
file->f_pos = offset;
|
||||
rc = file->f_pos;
|
||||
break;
|
||||
case 1:
|
||||
file->f_pos += offset;
|
||||
rc = file->f_pos;
|
||||
break;
|
||||
default:
|
||||
rc = -EINVAL;
|
||||
}
|
||||
rc = no_seek_end_llseek(file, offset, orig);
|
||||
mutex_unlock(&zcore_mutex);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue