lseek: the "whence" argument is called "whence"
But the kernel decided to call it "origin" instead. Fix most of the sites. Acked-by: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
c0f041602c
commit
965c8e59cf
@ -16,7 +16,7 @@
|
|||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
|
|
||||||
|
|
||||||
static loff_t bad_file_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t bad_file_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
@ -321,7 +321,7 @@ static int blkdev_write_end(struct file *file, struct address_space *mapping,
|
|||||||
* for a block special file file->f_path.dentry->d_inode->i_size is zero
|
* for a block special file file->f_path.dentry->d_inode->i_size is zero
|
||||||
* so we compute the size by hand (just as in block_read/write above)
|
* so we compute the size by hand (just as in block_read/write above)
|
||||||
*/
|
*/
|
||||||
static loff_t block_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t block_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *bd_inode = file->f_mapping->host;
|
struct inode *bd_inode = file->f_mapping->host;
|
||||||
loff_t size;
|
loff_t size;
|
||||||
@ -331,7 +331,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin)
|
|||||||
size = i_size_read(bd_inode);
|
size = i_size_read(bd_inode);
|
||||||
|
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
offset += size;
|
offset += size;
|
||||||
break;
|
break;
|
||||||
|
@ -2120,7 +2120,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
|
static int find_desired_extent(struct inode *inode, loff_t *offset, int whence)
|
||||||
{
|
{
|
||||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||||
struct extent_map *em;
|
struct extent_map *em;
|
||||||
@ -2154,7 +2154,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
|
|||||||
* before the position we want in case there is outstanding delalloc
|
* before the position we want in case there is outstanding delalloc
|
||||||
* going on here.
|
* going on here.
|
||||||
*/
|
*/
|
||||||
if (origin == SEEK_HOLE && start != 0) {
|
if (whence == SEEK_HOLE && start != 0) {
|
||||||
if (start <= root->sectorsize)
|
if (start <= root->sectorsize)
|
||||||
em = btrfs_get_extent_fiemap(inode, NULL, 0, 0,
|
em = btrfs_get_extent_fiemap(inode, NULL, 0, 0,
|
||||||
root->sectorsize, 0);
|
root->sectorsize, 0);
|
||||||
@ -2188,13 +2188,13 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (origin == SEEK_HOLE) {
|
if (whence == SEEK_HOLE) {
|
||||||
*offset = start;
|
*offset = start;
|
||||||
free_extent_map(em);
|
free_extent_map(em);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (origin == SEEK_DATA) {
|
if (whence == SEEK_DATA) {
|
||||||
if (em->block_start == EXTENT_MAP_DELALLOC) {
|
if (em->block_start == EXTENT_MAP_DELALLOC) {
|
||||||
if (start >= inode->i_size) {
|
if (start >= inode->i_size) {
|
||||||
free_extent_map(em);
|
free_extent_map(em);
|
||||||
@ -2231,16 +2231,16 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
case SEEK_CUR:
|
case SEEK_CUR:
|
||||||
offset = generic_file_llseek(file, offset, origin);
|
offset = generic_file_llseek(file, offset, whence);
|
||||||
goto out;
|
goto out;
|
||||||
case SEEK_DATA:
|
case SEEK_DATA:
|
||||||
case SEEK_HOLE:
|
case SEEK_HOLE:
|
||||||
@ -2249,7 +2249,7 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin)
|
|||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = find_desired_extent(inode, &offset, origin);
|
ret = find_desired_extent(inode, &offset, whence);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
mutex_unlock(&inode->i_mutex);
|
mutex_unlock(&inode->i_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -454,7 +454,7 @@ static void reset_readdir(struct ceph_file_info *fi)
|
|||||||
fi->flags &= ~CEPH_F_ATEND;
|
fi->flags &= ~CEPH_F_ATEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct ceph_file_info *fi = file->private_data;
|
struct ceph_file_info *fi = file->private_data;
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
@ -463,7 +463,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin)
|
|||||||
|
|
||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
offset += inode->i_size + 2; /* FIXME */
|
offset += inode->i_size + 2; /* FIXME */
|
||||||
break;
|
break;
|
||||||
|
@ -797,7 +797,7 @@ out:
|
|||||||
/*
|
/*
|
||||||
* llseek. be sure to verify file size on SEEK_END.
|
* llseek. be sure to verify file size on SEEK_END.
|
||||||
*/
|
*/
|
||||||
static loff_t ceph_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
int ret;
|
int ret;
|
||||||
@ -805,7 +805,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int origin)
|
|||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
__ceph_do_pending_vmtruncate(inode);
|
__ceph_do_pending_vmtruncate(inode);
|
||||||
|
|
||||||
if (origin == SEEK_END || origin == SEEK_DATA || origin == SEEK_HOLE) {
|
if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) {
|
||||||
ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE);
|
ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
offset = ret;
|
offset = ret;
|
||||||
@ -813,7 +813,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int origin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
offset += inode->i_size;
|
offset += inode->i_size;
|
||||||
break;
|
break;
|
||||||
|
@ -695,13 +695,13 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
|||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t cifs_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
|
* whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
|
||||||
* the cached file length
|
* the cached file length
|
||||||
*/
|
*/
|
||||||
if (origin != SEEK_SET && origin != SEEK_CUR) {
|
if (whence != SEEK_SET && whence != SEEK_CUR) {
|
||||||
int rc;
|
int rc;
|
||||||
struct inode *inode = file->f_path.dentry->d_inode;
|
struct inode *inode = file->f_path.dentry->d_inode;
|
||||||
|
|
||||||
@ -728,7 +728,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
|
|||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return (loff_t)rc;
|
return (loff_t)rc;
|
||||||
}
|
}
|
||||||
return generic_file_llseek(file, offset, origin);
|
return generic_file_llseek(file, offset, whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
|
static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
|
||||||
|
@ -1613,12 +1613,12 @@ static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t configfs_dir_lseek(struct file * file, loff_t offset, int origin)
|
static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct dentry * dentry = file->f_path.dentry;
|
struct dentry * dentry = file->f_path.dentry;
|
||||||
|
|
||||||
mutex_lock(&dentry->d_inode->i_mutex);
|
mutex_lock(&dentry->d_inode->i_mutex);
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case 1:
|
case 1:
|
||||||
offset += file->f_pos;
|
offset += file->f_pos;
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -296,17 +296,17 @@ static inline loff_t ext3_get_htree_eof(struct file *filp)
|
|||||||
* NOTE: offsets obtained *before* ext3_set_inode_flag(dir, EXT3_INODE_INDEX)
|
* NOTE: offsets obtained *before* ext3_set_inode_flag(dir, EXT3_INODE_INDEX)
|
||||||
* will be invalid once the directory was converted into a dx directory
|
* will be invalid once the directory was converted into a dx directory
|
||||||
*/
|
*/
|
||||||
loff_t ext3_dir_llseek(struct file *file, loff_t offset, int origin)
|
loff_t ext3_dir_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
int dx_dir = is_dx_dir(inode);
|
int dx_dir = is_dx_dir(inode);
|
||||||
loff_t htree_max = ext3_get_htree_eof(file);
|
loff_t htree_max = ext3_get_htree_eof(file);
|
||||||
|
|
||||||
if (likely(dx_dir))
|
if (likely(dx_dir))
|
||||||
return generic_file_llseek_size(file, offset, origin,
|
return generic_file_llseek_size(file, offset, whence,
|
||||||
htree_max, htree_max);
|
htree_max, htree_max);
|
||||||
else
|
else
|
||||||
return generic_file_llseek(file, offset, origin);
|
return generic_file_llseek(file, offset, whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -333,17 +333,17 @@ static inline loff_t ext4_get_htree_eof(struct file *filp)
|
|||||||
*
|
*
|
||||||
* For non-htree, ext4_llseek already chooses the proper max offset.
|
* For non-htree, ext4_llseek already chooses the proper max offset.
|
||||||
*/
|
*/
|
||||||
loff_t ext4_dir_llseek(struct file *file, loff_t offset, int origin)
|
loff_t ext4_dir_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
int dx_dir = is_dx_dir(inode);
|
int dx_dir = is_dx_dir(inode);
|
||||||
loff_t htree_max = ext4_get_htree_eof(file);
|
loff_t htree_max = ext4_get_htree_eof(file);
|
||||||
|
|
||||||
if (likely(dx_dir))
|
if (likely(dx_dir))
|
||||||
return generic_file_llseek_size(file, offset, origin,
|
return generic_file_llseek_size(file, offset, whence,
|
||||||
htree_max, htree_max);
|
htree_max, htree_max);
|
||||||
else
|
else
|
||||||
return ext4_llseek(file, offset, origin);
|
return ext4_llseek(file, offset, whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -303,7 +303,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
|
|||||||
* page cache has data or not.
|
* page cache has data or not.
|
||||||
*/
|
*/
|
||||||
static int ext4_find_unwritten_pgoff(struct inode *inode,
|
static int ext4_find_unwritten_pgoff(struct inode *inode,
|
||||||
int origin,
|
int whence,
|
||||||
struct ext4_map_blocks *map,
|
struct ext4_map_blocks *map,
|
||||||
loff_t *offset)
|
loff_t *offset)
|
||||||
{
|
{
|
||||||
@ -333,10 +333,10 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
|
|||||||
nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,
|
nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,
|
||||||
(pgoff_t)num);
|
(pgoff_t)num);
|
||||||
if (nr_pages == 0) {
|
if (nr_pages == 0) {
|
||||||
if (origin == SEEK_DATA)
|
if (whence == SEEK_DATA)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
BUG_ON(origin != SEEK_HOLE);
|
BUG_ON(whence != SEEK_HOLE);
|
||||||
/*
|
/*
|
||||||
* If this is the first time to go into the loop and
|
* If this is the first time to go into the loop and
|
||||||
* offset is not beyond the end offset, it will be a
|
* offset is not beyond the end offset, it will be a
|
||||||
@ -352,7 +352,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
|
|||||||
* offset is smaller than the first page offset, it will be a
|
* offset is smaller than the first page offset, it will be a
|
||||||
* hole at this offset.
|
* hole at this offset.
|
||||||
*/
|
*/
|
||||||
if (lastoff == startoff && origin == SEEK_HOLE &&
|
if (lastoff == startoff && whence == SEEK_HOLE &&
|
||||||
lastoff < page_offset(pvec.pages[0])) {
|
lastoff < page_offset(pvec.pages[0])) {
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
@ -366,7 +366,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
|
|||||||
* If the current offset is not beyond the end of given
|
* If the current offset is not beyond the end of given
|
||||||
* range, it will be a hole.
|
* range, it will be a hole.
|
||||||
*/
|
*/
|
||||||
if (lastoff < endoff && origin == SEEK_HOLE &&
|
if (lastoff < endoff && whence == SEEK_HOLE &&
|
||||||
page->index > end) {
|
page->index > end) {
|
||||||
found = 1;
|
found = 1;
|
||||||
*offset = lastoff;
|
*offset = lastoff;
|
||||||
@ -391,10 +391,10 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
|
|||||||
do {
|
do {
|
||||||
if (buffer_uptodate(bh) ||
|
if (buffer_uptodate(bh) ||
|
||||||
buffer_unwritten(bh)) {
|
buffer_unwritten(bh)) {
|
||||||
if (origin == SEEK_DATA)
|
if (whence == SEEK_DATA)
|
||||||
found = 1;
|
found = 1;
|
||||||
} else {
|
} else {
|
||||||
if (origin == SEEK_HOLE)
|
if (whence == SEEK_HOLE)
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
@ -416,7 +416,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
|
|||||||
* The no. of pages is less than our desired, that would be a
|
* The no. of pages is less than our desired, that would be a
|
||||||
* hole in there.
|
* hole in there.
|
||||||
*/
|
*/
|
||||||
if (nr_pages < num && origin == SEEK_HOLE) {
|
if (nr_pages < num && whence == SEEK_HOLE) {
|
||||||
found = 1;
|
found = 1;
|
||||||
*offset = lastoff;
|
*offset = lastoff;
|
||||||
break;
|
break;
|
||||||
@ -609,7 +609,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
|
|||||||
* by calling generic_file_llseek_size() with the appropriate maxbytes
|
* by calling generic_file_llseek_size() with the appropriate maxbytes
|
||||||
* value for each.
|
* value for each.
|
||||||
*/
|
*/
|
||||||
loff_t ext4_llseek(struct file *file, loff_t offset, int origin)
|
loff_t ext4_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
loff_t maxbytes;
|
loff_t maxbytes;
|
||||||
@ -619,11 +619,11 @@ loff_t ext4_llseek(struct file *file, loff_t offset, int origin)
|
|||||||
else
|
else
|
||||||
maxbytes = inode->i_sb->s_maxbytes;
|
maxbytes = inode->i_sb->s_maxbytes;
|
||||||
|
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case SEEK_SET:
|
case SEEK_SET:
|
||||||
case SEEK_CUR:
|
case SEEK_CUR:
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
return generic_file_llseek_size(file, offset, origin,
|
return generic_file_llseek_size(file, offset, whence,
|
||||||
maxbytes, i_size_read(inode));
|
maxbytes, i_size_read(inode));
|
||||||
case SEEK_DATA:
|
case SEEK_DATA:
|
||||||
return ext4_seek_data(file, offset, maxbytes);
|
return ext4_seek_data(file, offset, maxbytes);
|
||||||
|
@ -1599,19 +1599,19 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
|
|||||||
return err ? 0 : outarg.block;
|
return err ? 0 : outarg.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t fuse_file_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
loff_t retval;
|
loff_t retval;
|
||||||
struct inode *inode = file->f_path.dentry->d_inode;
|
struct inode *inode = file->f_path.dentry->d_inode;
|
||||||
|
|
||||||
/* No i_mutex protection necessary for SEEK_CUR and SEEK_SET */
|
/* No i_mutex protection necessary for SEEK_CUR and SEEK_SET */
|
||||||
if (origin == SEEK_CUR || origin == SEEK_SET)
|
if (whence == SEEK_CUR || whence == SEEK_SET)
|
||||||
return generic_file_llseek(file, offset, origin);
|
return generic_file_llseek(file, offset, whence);
|
||||||
|
|
||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
retval = fuse_update_attributes(inode, NULL, file, NULL);
|
retval = fuse_update_attributes(inode, NULL, file, NULL);
|
||||||
if (!retval)
|
if (!retval)
|
||||||
retval = generic_file_llseek(file, offset, origin);
|
retval = generic_file_llseek(file, offset, whence);
|
||||||
mutex_unlock(&inode->i_mutex);
|
mutex_unlock(&inode->i_mutex);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
* gfs2_llseek - seek to a location in a file
|
* gfs2_llseek - seek to a location in a file
|
||||||
* @file: the file
|
* @file: the file
|
||||||
* @offset: the offset
|
* @offset: the offset
|
||||||
* @origin: Where to seek from (SEEK_SET, SEEK_CUR, or SEEK_END)
|
* @whence: Where to seek from (SEEK_SET, SEEK_CUR, or SEEK_END)
|
||||||
*
|
*
|
||||||
* SEEK_END requires the glock for the file because it references the
|
* SEEK_END requires the glock for the file because it references the
|
||||||
* file's size.
|
* file's size.
|
||||||
@ -52,26 +52,26 @@
|
|||||||
* Returns: The new offset, or errno
|
* Returns: The new offset, or errno
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t gfs2_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
|
struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
|
||||||
struct gfs2_holder i_gh;
|
struct gfs2_holder i_gh;
|
||||||
loff_t error;
|
loff_t error;
|
||||||
|
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case SEEK_END: /* These reference inode->i_size */
|
case SEEK_END: /* These reference inode->i_size */
|
||||||
case SEEK_DATA:
|
case SEEK_DATA:
|
||||||
case SEEK_HOLE:
|
case SEEK_HOLE:
|
||||||
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
|
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
|
||||||
&i_gh);
|
&i_gh);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
error = generic_file_llseek(file, offset, origin);
|
error = generic_file_llseek(file, offset, whence);
|
||||||
gfs2_glock_dq_uninit(&i_gh);
|
gfs2_glock_dq_uninit(&i_gh);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEEK_CUR:
|
case SEEK_CUR:
|
||||||
case SEEK_SET:
|
case SEEK_SET:
|
||||||
error = generic_file_llseek(file, offset, origin);
|
error = generic_file_llseek(file, offset, whence);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error = -EINVAL;
|
error = -EINVAL;
|
||||||
|
@ -81,11 +81,11 @@ int dcache_dir_close(struct inode *inode, struct file *file)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
|
loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct dentry *dentry = file->f_path.dentry;
|
struct dentry *dentry = file->f_path.dentry;
|
||||||
mutex_lock(&dentry->d_inode->i_mutex);
|
mutex_lock(&dentry->d_inode->i_mutex);
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case 1:
|
case 1:
|
||||||
offset += file->f_pos;
|
offset += file->f_pos;
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -871,7 +871,7 @@ out:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
|
static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct dentry *dentry = filp->f_path.dentry;
|
struct dentry *dentry = filp->f_path.dentry;
|
||||||
struct inode *inode = dentry->d_inode;
|
struct inode *inode = dentry->d_inode;
|
||||||
@ -880,10 +880,10 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
|
|||||||
dfprintk(FILE, "NFS: llseek dir(%s/%s, %lld, %d)\n",
|
dfprintk(FILE, "NFS: llseek dir(%s/%s, %lld, %d)\n",
|
||||||
dentry->d_parent->d_name.name,
|
dentry->d_parent->d_name.name,
|
||||||
dentry->d_name.name,
|
dentry->d_name.name,
|
||||||
offset, origin);
|
offset, whence);
|
||||||
|
|
||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case 1:
|
case 1:
|
||||||
offset += filp->f_pos;
|
offset += filp->f_pos;
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -119,18 +119,18 @@ force_reval:
|
|||||||
return __nfs_revalidate_inode(server, inode);
|
return __nfs_revalidate_inode(server, inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
|
loff_t nfs_file_llseek(struct file *filp, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
dprintk("NFS: llseek file(%s/%s, %lld, %d)\n",
|
dprintk("NFS: llseek file(%s/%s, %lld, %d)\n",
|
||||||
filp->f_path.dentry->d_parent->d_name.name,
|
filp->f_path.dentry->d_parent->d_name.name,
|
||||||
filp->f_path.dentry->d_name.name,
|
filp->f_path.dentry->d_name.name,
|
||||||
offset, origin);
|
offset, whence);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
|
* whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
|
||||||
* the cached file length
|
* the cached file length
|
||||||
*/
|
*/
|
||||||
if (origin != SEEK_SET && origin != SEEK_CUR) {
|
if (whence != SEEK_SET && whence != SEEK_CUR) {
|
||||||
struct inode *inode = filp->f_mapping->host;
|
struct inode *inode = filp->f_mapping->host;
|
||||||
|
|
||||||
int retval = nfs_revalidate_file_size(inode, filp);
|
int retval = nfs_revalidate_file_size(inode, filp);
|
||||||
@ -138,7 +138,7 @@ loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
|
|||||||
return (loff_t)retval;
|
return (loff_t)retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
return generic_file_llseek(filp, offset, origin);
|
return generic_file_llseek(filp, offset, whence);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(nfs_file_llseek);
|
EXPORT_SYMBOL_GPL(nfs_file_llseek);
|
||||||
|
|
||||||
|
@ -832,7 +832,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin)
|
int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
int ret;
|
int ret;
|
||||||
@ -843,7 +843,7 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin)
|
|||||||
struct buffer_head *di_bh = NULL;
|
struct buffer_head *di_bh = NULL;
|
||||||
struct ocfs2_extent_rec rec;
|
struct ocfs2_extent_rec rec;
|
||||||
|
|
||||||
BUG_ON(origin != SEEK_DATA && origin != SEEK_HOLE);
|
BUG_ON(whence != SEEK_DATA && whence != SEEK_HOLE);
|
||||||
|
|
||||||
ret = ocfs2_inode_lock(inode, &di_bh, 0);
|
ret = ocfs2_inode_lock(inode, &di_bh, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@ -859,7 +859,7 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
|
if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
|
||||||
if (origin == SEEK_HOLE)
|
if (whence == SEEK_HOLE)
|
||||||
*offset = inode->i_size;
|
*offset = inode->i_size;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
@ -888,8 +888,8 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin)
|
|||||||
is_data = (rec.e_flags & OCFS2_EXT_UNWRITTEN) ? 0 : 1;
|
is_data = (rec.e_flags & OCFS2_EXT_UNWRITTEN) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!is_data && origin == SEEK_HOLE) ||
|
if ((!is_data && whence == SEEK_HOLE) ||
|
||||||
(is_data && origin == SEEK_DATA)) {
|
(is_data && whence == SEEK_DATA)) {
|
||||||
if (extoff > *offset)
|
if (extoff > *offset)
|
||||||
*offset = extoff;
|
*offset = extoff;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
@ -899,7 +899,7 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin)
|
|||||||
cpos += clen;
|
cpos += clen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (origin == SEEK_HOLE) {
|
if (whence == SEEK_HOLE) {
|
||||||
extoff = cpos;
|
extoff = cpos;
|
||||||
extoff <<= cs_bits;
|
extoff <<= cs_bits;
|
||||||
extlen = clen;
|
extlen = clen;
|
||||||
|
@ -2637,14 +2637,14 @@ bail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Refer generic_file_llseek_unlocked() */
|
/* Refer generic_file_llseek_unlocked() */
|
||||||
static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
|
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case SEEK_SET:
|
case SEEK_SET:
|
||||||
break;
|
break;
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
@ -2659,7 +2659,7 @@ static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int origin)
|
|||||||
break;
|
break;
|
||||||
case SEEK_DATA:
|
case SEEK_DATA:
|
||||||
case SEEK_HOLE:
|
case SEEK_HOLE:
|
||||||
ret = ocfs2_seek_data_hole_offset(file, &offset, origin);
|
ret = ocfs2_seek_data_hole_offset(file, &offset, whence);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
break;
|
break;
|
||||||
|
@ -151,13 +151,13 @@ static int pstore_file_open(struct inode *inode, struct file *file)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t pstore_file_llseek(struct file *file, loff_t off, int origin)
|
static loff_t pstore_file_llseek(struct file *file, loff_t off, int whence)
|
||||||
{
|
{
|
||||||
struct seq_file *sf = file->private_data;
|
struct seq_file *sf = file->private_data;
|
||||||
|
|
||||||
if (sf->op)
|
if (sf->op)
|
||||||
return seq_lseek(file, off, origin);
|
return seq_lseek(file, off, whence);
|
||||||
return default_llseek(file, off, origin);
|
return default_llseek(file, off, whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations pstore_file_operations = {
|
static const struct file_operations pstore_file_operations = {
|
||||||
|
@ -54,7 +54,7 @@ static loff_t lseek_execute(struct file *file, struct inode *inode,
|
|||||||
* generic_file_llseek_size - generic llseek implementation for regular files
|
* generic_file_llseek_size - generic llseek implementation for regular files
|
||||||
* @file: file structure to seek on
|
* @file: file structure to seek on
|
||||||
* @offset: file offset to seek to
|
* @offset: file offset to seek to
|
||||||
* @origin: type of seek
|
* @whence: type of seek
|
||||||
* @size: max size of this file in file system
|
* @size: max size of this file in file system
|
||||||
* @eof: offset used for SEEK_END position
|
* @eof: offset used for SEEK_END position
|
||||||
*
|
*
|
||||||
@ -67,12 +67,12 @@ static loff_t lseek_execute(struct file *file, struct inode *inode,
|
|||||||
* read/writes behave like SEEK_SET against seeks.
|
* read/writes behave like SEEK_SET against seeks.
|
||||||
*/
|
*/
|
||||||
loff_t
|
loff_t
|
||||||
generic_file_llseek_size(struct file *file, loff_t offset, int origin,
|
generic_file_llseek_size(struct file *file, loff_t offset, int whence,
|
||||||
loff_t maxsize, loff_t eof)
|
loff_t maxsize, loff_t eof)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
|
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
offset += eof;
|
offset += eof;
|
||||||
break;
|
break;
|
||||||
@ -122,17 +122,17 @@ EXPORT_SYMBOL(generic_file_llseek_size);
|
|||||||
* generic_file_llseek - generic llseek implementation for regular files
|
* generic_file_llseek - generic llseek implementation for regular files
|
||||||
* @file: file structure to seek on
|
* @file: file structure to seek on
|
||||||
* @offset: file offset to seek to
|
* @offset: file offset to seek to
|
||||||
* @origin: type of seek
|
* @whence: type of seek
|
||||||
*
|
*
|
||||||
* This is a generic implemenation of ->llseek useable for all normal local
|
* This is a generic implemenation of ->llseek useable for all normal local
|
||||||
* filesystems. It just updates the file offset to the value specified by
|
* filesystems. It just updates the file offset to the value specified by
|
||||||
* @offset and @origin under i_mutex.
|
* @offset and @whence under i_mutex.
|
||||||
*/
|
*/
|
||||||
loff_t generic_file_llseek(struct file *file, loff_t offset, int origin)
|
loff_t generic_file_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
|
|
||||||
return generic_file_llseek_size(file, offset, origin,
|
return generic_file_llseek_size(file, offset, whence,
|
||||||
inode->i_sb->s_maxbytes,
|
inode->i_sb->s_maxbytes,
|
||||||
i_size_read(inode));
|
i_size_read(inode));
|
||||||
}
|
}
|
||||||
@ -142,32 +142,32 @@ EXPORT_SYMBOL(generic_file_llseek);
|
|||||||
* noop_llseek - No Operation Performed llseek implementation
|
* noop_llseek - No Operation Performed llseek implementation
|
||||||
* @file: file structure to seek on
|
* @file: file structure to seek on
|
||||||
* @offset: file offset to seek to
|
* @offset: file offset to seek to
|
||||||
* @origin: type of seek
|
* @whence: type of seek
|
||||||
*
|
*
|
||||||
* This is an implementation of ->llseek useable for the rare special case when
|
* This is an implementation of ->llseek useable for the rare special case when
|
||||||
* userspace expects the seek to succeed but the (device) file is actually not
|
* userspace expects the seek to succeed but the (device) file is actually not
|
||||||
* able to perform the seek. In this case you use noop_llseek() instead of
|
* able to perform the seek. In this case you use noop_llseek() instead of
|
||||||
* falling back to the default implementation of ->llseek.
|
* falling back to the default implementation of ->llseek.
|
||||||
*/
|
*/
|
||||||
loff_t noop_llseek(struct file *file, loff_t offset, int origin)
|
loff_t noop_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
return file->f_pos;
|
return file->f_pos;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(noop_llseek);
|
EXPORT_SYMBOL(noop_llseek);
|
||||||
|
|
||||||
loff_t no_llseek(struct file *file, loff_t offset, int origin)
|
loff_t no_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
return -ESPIPE;
|
return -ESPIPE;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(no_llseek);
|
EXPORT_SYMBOL(no_llseek);
|
||||||
|
|
||||||
loff_t default_llseek(struct file *file, loff_t offset, int origin)
|
loff_t default_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_path.dentry->d_inode;
|
struct inode *inode = file->f_path.dentry->d_inode;
|
||||||
loff_t retval;
|
loff_t retval;
|
||||||
|
|
||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
offset += i_size_read(inode);
|
offset += i_size_read(inode);
|
||||||
break;
|
break;
|
||||||
@ -216,7 +216,7 @@ out:
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(default_llseek);
|
EXPORT_SYMBOL(default_llseek);
|
||||||
|
|
||||||
loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
|
loff_t vfs_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
loff_t (*fn)(struct file *, loff_t, int);
|
loff_t (*fn)(struct file *, loff_t, int);
|
||||||
|
|
||||||
@ -225,11 +225,11 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
|
|||||||
if (file->f_op && file->f_op->llseek)
|
if (file->f_op && file->f_op->llseek)
|
||||||
fn = file->f_op->llseek;
|
fn = file->f_op->llseek;
|
||||||
}
|
}
|
||||||
return fn(file, offset, origin);
|
return fn(file, offset, whence);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(vfs_llseek);
|
EXPORT_SYMBOL(vfs_llseek);
|
||||||
|
|
||||||
SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin)
|
SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence)
|
||||||
{
|
{
|
||||||
off_t retval;
|
off_t retval;
|
||||||
struct fd f = fdget(fd);
|
struct fd f = fdget(fd);
|
||||||
@ -237,8 +237,8 @@ SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin)
|
|||||||
return -EBADF;
|
return -EBADF;
|
||||||
|
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
if (origin <= SEEK_MAX) {
|
if (whence <= SEEK_MAX) {
|
||||||
loff_t res = vfs_llseek(f.file, offset, origin);
|
loff_t res = vfs_llseek(f.file, offset, whence);
|
||||||
retval = res;
|
retval = res;
|
||||||
if (res != (loff_t)retval)
|
if (res != (loff_t)retval)
|
||||||
retval = -EOVERFLOW; /* LFS: should only happen on 32 bit platforms */
|
retval = -EOVERFLOW; /* LFS: should only happen on 32 bit platforms */
|
||||||
@ -250,7 +250,7 @@ SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin)
|
|||||||
#ifdef __ARCH_WANT_SYS_LLSEEK
|
#ifdef __ARCH_WANT_SYS_LLSEEK
|
||||||
SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
|
SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
|
||||||
unsigned long, offset_low, loff_t __user *, result,
|
unsigned long, offset_low, loff_t __user *, result,
|
||||||
unsigned int, origin)
|
unsigned int, whence)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
struct fd f = fdget(fd);
|
struct fd f = fdget(fd);
|
||||||
@ -260,11 +260,11 @@ SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
|
|||||||
return -EBADF;
|
return -EBADF;
|
||||||
|
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
if (origin > SEEK_MAX)
|
if (whence > SEEK_MAX)
|
||||||
goto out_putf;
|
goto out_putf;
|
||||||
|
|
||||||
offset = vfs_llseek(f.file, ((loff_t) offset_high << 32) | offset_low,
|
offset = vfs_llseek(f.file, ((loff_t) offset_high << 32) | offset_low,
|
||||||
origin);
|
whence);
|
||||||
|
|
||||||
retval = (int)offset;
|
retval = (int)offset;
|
||||||
if (offset >= 0) {
|
if (offset >= 0) {
|
||||||
|
@ -300,14 +300,14 @@ EXPORT_SYMBOL(seq_read);
|
|||||||
*
|
*
|
||||||
* Ready-made ->f_op->llseek()
|
* Ready-made ->f_op->llseek()
|
||||||
*/
|
*/
|
||||||
loff_t seq_lseek(struct file *file, loff_t offset, int origin)
|
loff_t seq_lseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct seq_file *m = file->private_data;
|
struct seq_file *m = file->private_data;
|
||||||
loff_t retval = -EINVAL;
|
loff_t retval = -EINVAL;
|
||||||
|
|
||||||
mutex_lock(&m->lock);
|
mutex_lock(&m->lock);
|
||||||
m->version = file->f_version;
|
m->version = file->f_version;
|
||||||
switch (origin) {
|
switch (whence) {
|
||||||
case 1:
|
case 1:
|
||||||
offset += file->f_pos;
|
offset += file->f_pos;
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -453,11 +453,11 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If a directory is seeked, we have to free saved readdir() state */
|
/* If a directory is seeked, we have to free saved readdir() state */
|
||||||
static loff_t ubifs_dir_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t ubifs_dir_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
kfree(file->private_data);
|
kfree(file->private_data);
|
||||||
file->private_data = NULL;
|
file->private_data = NULL;
|
||||||
return generic_file_llseek(file, offset, origin);
|
return generic_file_llseek(file, offset, whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free saved readdir() state when the directory is closed */
|
/* Free saved readdir() state when the directory is closed */
|
||||||
|
@ -2286,9 +2286,9 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *);
|
|||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
|
|
||||||
/* needed for stackable file system support */
|
/* needed for stackable file system support */
|
||||||
extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
|
extern loff_t default_llseek(struct file *file, loff_t offset, int whence);
|
||||||
|
|
||||||
extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
|
extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
|
||||||
|
|
||||||
extern int inode_init_always(struct super_block *, struct inode *);
|
extern int inode_init_always(struct super_block *, struct inode *);
|
||||||
extern void inode_init_once(struct inode *);
|
extern void inode_init_once(struct inode *);
|
||||||
@ -2396,11 +2396,11 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
|
|||||||
|
|
||||||
extern void
|
extern void
|
||||||
file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
|
file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
|
||||||
extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
|
extern loff_t noop_llseek(struct file *file, loff_t offset, int whence);
|
||||||
extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
|
extern loff_t no_llseek(struct file *file, loff_t offset, int whence);
|
||||||
extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
|
extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence);
|
||||||
extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,
|
extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,
|
||||||
int origin, loff_t maxsize, loff_t eof);
|
int whence, loff_t maxsize, loff_t eof);
|
||||||
extern int generic_file_open(struct inode * inode, struct file * filp);
|
extern int generic_file_open(struct inode * inode, struct file * filp);
|
||||||
extern int nonseekable_open(struct inode * inode, struct file * filp);
|
extern int nonseekable_open(struct inode * inode, struct file * filp);
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
|
|||||||
size_t cnt, loff_t *ppos);
|
size_t cnt, loff_t *ppos);
|
||||||
ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
|
ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
|
||||||
size_t cnt, loff_t *ppos);
|
size_t cnt, loff_t *ppos);
|
||||||
loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin);
|
loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence);
|
||||||
int ftrace_regex_release(struct inode *inode, struct file *file);
|
int ftrace_regex_release(struct inode *inode, struct file *file);
|
||||||
|
|
||||||
void __init
|
void __init
|
||||||
@ -559,7 +559,7 @@ static inline ssize_t ftrace_filter_write(struct file *file, const char __user *
|
|||||||
size_t cnt, loff_t *ppos) { return -ENODEV; }
|
size_t cnt, loff_t *ppos) { return -ENODEV; }
|
||||||
static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
|
static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
|
||||||
size_t cnt, loff_t *ppos) { return -ENODEV; }
|
size_t cnt, loff_t *ppos) { return -ENODEV; }
|
||||||
static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin)
|
static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
@ -560,10 +560,10 @@ asmlinkage long sys_utime(char __user *filename,
|
|||||||
asmlinkage long sys_utimes(char __user *filename,
|
asmlinkage long sys_utimes(char __user *filename,
|
||||||
struct timeval __user *utimes);
|
struct timeval __user *utimes);
|
||||||
asmlinkage long sys_lseek(unsigned int fd, off_t offset,
|
asmlinkage long sys_lseek(unsigned int fd, off_t offset,
|
||||||
unsigned int origin);
|
unsigned int whence);
|
||||||
asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
|
asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
|
||||||
unsigned long offset_low, loff_t __user *result,
|
unsigned long offset_low, loff_t __user *result,
|
||||||
unsigned int origin);
|
unsigned int whence);
|
||||||
asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
|
asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
|
||||||
asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
|
asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
|
||||||
asmlinkage long sys_readv(unsigned long fd,
|
asmlinkage long sys_readv(unsigned long fd,
|
||||||
|
@ -2675,12 +2675,12 @@ ftrace_notrace_open(struct inode *inode, struct file *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
loff_t
|
loff_t
|
||||||
ftrace_regex_lseek(struct file *file, loff_t offset, int origin)
|
ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
loff_t ret;
|
loff_t ret;
|
||||||
|
|
||||||
if (file->f_mode & FMODE_READ)
|
if (file->f_mode & FMODE_READ)
|
||||||
ret = seq_lseek(file, offset, origin);
|
ret = seq_lseek(file, offset, whence);
|
||||||
else
|
else
|
||||||
file->f_pos = ret = 1;
|
file->f_pos = ret = 1;
|
||||||
|
|
||||||
|
20
mm/shmem.c
20
mm/shmem.c
@ -1719,7 +1719,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos,
|
|||||||
* llseek SEEK_DATA or SEEK_HOLE through the radix_tree.
|
* llseek SEEK_DATA or SEEK_HOLE through the radix_tree.
|
||||||
*/
|
*/
|
||||||
static pgoff_t shmem_seek_hole_data(struct address_space *mapping,
|
static pgoff_t shmem_seek_hole_data(struct address_space *mapping,
|
||||||
pgoff_t index, pgoff_t end, int origin)
|
pgoff_t index, pgoff_t end, int whence)
|
||||||
{
|
{
|
||||||
struct page *page;
|
struct page *page;
|
||||||
struct pagevec pvec;
|
struct pagevec pvec;
|
||||||
@ -1733,13 +1733,13 @@ static pgoff_t shmem_seek_hole_data(struct address_space *mapping,
|
|||||||
pvec.nr = shmem_find_get_pages_and_swap(mapping, index,
|
pvec.nr = shmem_find_get_pages_and_swap(mapping, index,
|
||||||
pvec.nr, pvec.pages, indices);
|
pvec.nr, pvec.pages, indices);
|
||||||
if (!pvec.nr) {
|
if (!pvec.nr) {
|
||||||
if (origin == SEEK_DATA)
|
if (whence == SEEK_DATA)
|
||||||
index = end;
|
index = end;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (i = 0; i < pvec.nr; i++, index++) {
|
for (i = 0; i < pvec.nr; i++, index++) {
|
||||||
if (index < indices[i]) {
|
if (index < indices[i]) {
|
||||||
if (origin == SEEK_HOLE) {
|
if (whence == SEEK_HOLE) {
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1751,8 +1751,8 @@ static pgoff_t shmem_seek_hole_data(struct address_space *mapping,
|
|||||||
page = NULL;
|
page = NULL;
|
||||||
}
|
}
|
||||||
if (index >= end ||
|
if (index >= end ||
|
||||||
(page && origin == SEEK_DATA) ||
|
(page && whence == SEEK_DATA) ||
|
||||||
(!page && origin == SEEK_HOLE)) {
|
(!page && whence == SEEK_HOLE)) {
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1765,15 +1765,15 @@ static pgoff_t shmem_seek_hole_data(struct address_space *mapping,
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t shmem_file_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct address_space *mapping = file->f_mapping;
|
struct address_space *mapping = file->f_mapping;
|
||||||
struct inode *inode = mapping->host;
|
struct inode *inode = mapping->host;
|
||||||
pgoff_t start, end;
|
pgoff_t start, end;
|
||||||
loff_t new_offset;
|
loff_t new_offset;
|
||||||
|
|
||||||
if (origin != SEEK_DATA && origin != SEEK_HOLE)
|
if (whence != SEEK_DATA && whence != SEEK_HOLE)
|
||||||
return generic_file_llseek_size(file, offset, origin,
|
return generic_file_llseek_size(file, offset, whence,
|
||||||
MAX_LFS_FILESIZE, i_size_read(inode));
|
MAX_LFS_FILESIZE, i_size_read(inode));
|
||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
/* We're holding i_mutex so we can access i_size directly */
|
/* We're holding i_mutex so we can access i_size directly */
|
||||||
@ -1785,12 +1785,12 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int origin)
|
|||||||
else {
|
else {
|
||||||
start = offset >> PAGE_CACHE_SHIFT;
|
start = offset >> PAGE_CACHE_SHIFT;
|
||||||
end = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
|
end = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
|
||||||
new_offset = shmem_seek_hole_data(mapping, start, end, origin);
|
new_offset = shmem_seek_hole_data(mapping, start, end, whence);
|
||||||
new_offset <<= PAGE_CACHE_SHIFT;
|
new_offset <<= PAGE_CACHE_SHIFT;
|
||||||
if (new_offset > offset) {
|
if (new_offset > offset) {
|
||||||
if (new_offset < inode->i_size)
|
if (new_offset < inode->i_size)
|
||||||
offset = new_offset;
|
offset = new_offset;
|
||||||
else if (origin == SEEK_DATA)
|
else if (whence == SEEK_DATA)
|
||||||
offset = -ENXIO;
|
offset = -ENXIO;
|
||||||
else
|
else
|
||||||
offset = inode->i_size;
|
offset = inode->i_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user