Skip to content

Commit

Permalink
lseek: the "whence" argument is called "whence"
Browse files Browse the repository at this point in the history
But the kernel decided to call it "origin" instead.  Fix most of the
sites.

Acked-by: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
akpm00 authored and torvalds committed Dec 18, 2012
1 parent c0f0416 commit 965c8e5
Show file tree
Hide file tree
Showing 26 changed files with 116 additions and 116 deletions.
2 changes: 1 addition & 1 deletion fs/bad_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#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;
}
Expand Down
4 changes: 2 additions & 2 deletions fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* 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;
loff_t size;
Expand All @@ -331,7 +331,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin)
size = i_size_read(bd_inode);

retval = -EINVAL;
switch (origin) {
switch (whence) {
case SEEK_END:
offset += size;
break;
Expand Down
16 changes: 8 additions & 8 deletions fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2120,7 +2120,7 @@ static long btrfs_fallocate(struct file *file, int mode,
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 extent_map *em;
Expand Down Expand Up @@ -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
* going on here.
*/
if (origin == SEEK_HOLE && start != 0) {
if (whence == SEEK_HOLE && start != 0) {
if (start <= root->sectorsize)
em = btrfs_get_extent_fiemap(inode, NULL, 0, 0,
root->sectorsize, 0);
Expand Down Expand Up @@ -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;
free_extent_map(em);
break;
}
} else {
if (origin == SEEK_DATA) {
if (whence == SEEK_DATA) {
if (em->block_start == EXTENT_MAP_DELALLOC) {
if (start >= inode->i_size) {
free_extent_map(em);
Expand Down Expand Up @@ -2231,16 +2231,16 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
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;
int ret;

mutex_lock(&inode->i_mutex);
switch (origin) {
switch (whence) {
case SEEK_END:
case SEEK_CUR:
offset = generic_file_llseek(file, offset, origin);
offset = generic_file_llseek(file, offset, whence);
goto out;
case SEEK_DATA:
case SEEK_HOLE:
Expand All @@ -2249,7 +2249,7 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin)
return -ENXIO;
}

ret = find_desired_extent(inode, &offset, origin);
ret = find_desired_extent(inode, &offset, whence);
if (ret) {
mutex_unlock(&inode->i_mutex);
return ret;
Expand Down
4 changes: 2 additions & 2 deletions fs/ceph/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ static void reset_readdir(struct ceph_file_info *fi)
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 inode *inode = file->f_mapping->host;
Expand All @@ -463,7 +463,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin)

mutex_lock(&inode->i_mutex);
retval = -EINVAL;
switch (origin) {
switch (whence) {
case SEEK_END:
offset += inode->i_size + 2; /* FIXME */
break;
Expand Down
6 changes: 3 additions & 3 deletions fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,23 +797,23 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
/*
* 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;
int ret;

mutex_lock(&inode->i_mutex);
__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);
if (ret < 0) {
offset = ret;
goto out;
}
}

switch (origin) {
switch (whence) {
case SEEK_END:
offset += inode->i_size;
break;
Expand Down
8 changes: 4 additions & 4 deletions fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,13 +695,13 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
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
*/
if (origin != SEEK_SET && origin != SEEK_CUR) {
if (whence != SEEK_SET && whence != SEEK_CUR) {
int rc;
struct inode *inode = file->f_path.dentry->d_inode;

Expand All @@ -728,7 +728,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
if (rc < 0)
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)
Expand Down
4 changes: 2 additions & 2 deletions fs/configfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1613,12 +1613,12 @@ static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir
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;

mutex_lock(&dentry->d_inode->i_mutex);
switch (origin) {
switch (whence) {
case 1:
offset += file->f_pos;
case 0:
Expand Down
6 changes: 3 additions & 3 deletions fs/ext3/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
* 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;
int dx_dir = is_dx_dir(inode);
loff_t htree_max = ext3_get_htree_eof(file);

if (likely(dx_dir))
return generic_file_llseek_size(file, offset, origin,
return generic_file_llseek_size(file, offset, whence,
htree_max, htree_max);
else
return generic_file_llseek(file, offset, origin);
return generic_file_llseek(file, offset, whence);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions fs/ext4/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
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;
int dx_dir = is_dx_dir(inode);
loff_t htree_max = ext4_get_htree_eof(file);

if (likely(dx_dir))
return generic_file_llseek_size(file, offset, origin,
return generic_file_llseek_size(file, offset, whence,
htree_max, htree_max);
else
return ext4_llseek(file, offset, origin);
return ext4_llseek(file, offset, whence);
}

/*
Expand Down
22 changes: 11 additions & 11 deletions fs/ext4/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
* page cache has data or not.
*/
static int ext4_find_unwritten_pgoff(struct inode *inode,
int origin,
int whence,
struct ext4_map_blocks *map,
loff_t *offset)
{
Expand Down Expand Up @@ -333,10 +333,10 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,
(pgoff_t)num);
if (nr_pages == 0) {
if (origin == SEEK_DATA)
if (whence == SEEK_DATA)
break;

BUG_ON(origin != SEEK_HOLE);
BUG_ON(whence != SEEK_HOLE);
/*
* If this is the first time to go into the loop and
* offset is not beyond the end offset, it will be a
Expand All @@ -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
* hole at this offset.
*/
if (lastoff == startoff && origin == SEEK_HOLE &&
if (lastoff == startoff && whence == SEEK_HOLE &&
lastoff < page_offset(pvec.pages[0])) {
found = 1;
break;
Expand All @@ -366,7 +366,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
* If the current offset is not beyond the end of given
* range, it will be a hole.
*/
if (lastoff < endoff && origin == SEEK_HOLE &&
if (lastoff < endoff && whence == SEEK_HOLE &&
page->index > end) {
found = 1;
*offset = lastoff;
Expand All @@ -391,10 +391,10 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
do {
if (buffer_uptodate(bh) ||
buffer_unwritten(bh)) {
if (origin == SEEK_DATA)
if (whence == SEEK_DATA)
found = 1;
} else {
if (origin == SEEK_HOLE)
if (whence == SEEK_HOLE)
found = 1;
}
if (found) {
Expand All @@ -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
* hole in there.
*/
if (nr_pages < num && origin == SEEK_HOLE) {
if (nr_pages < num && whence == SEEK_HOLE) {
found = 1;
*offset = lastoff;
break;
Expand Down Expand Up @@ -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
* 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;
loff_t maxbytes;
Expand All @@ -619,11 +619,11 @@ loff_t ext4_llseek(struct file *file, loff_t offset, int origin)
else
maxbytes = inode->i_sb->s_maxbytes;

switch (origin) {
switch (whence) {
case SEEK_SET:
case SEEK_CUR:
case SEEK_END:
return generic_file_llseek_size(file, offset, origin,
return generic_file_llseek_size(file, offset, whence,
maxbytes, i_size_read(inode));
case SEEK_DATA:
return ext4_seek_data(file, offset, maxbytes);
Expand Down
8 changes: 4 additions & 4 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,19 +1599,19 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t 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;
struct inode *inode = file->f_path.dentry->d_inode;

/* No i_mutex protection necessary for SEEK_CUR and SEEK_SET */
if (origin == SEEK_CUR || origin == SEEK_SET)
return generic_file_llseek(file, offset, origin);
if (whence == SEEK_CUR || whence == SEEK_SET)
return generic_file_llseek(file, offset, whence);

mutex_lock(&inode->i_mutex);
retval = fuse_update_attributes(inode, NULL, file, NULL);
if (!retval)
retval = generic_file_llseek(file, offset, origin);
retval = generic_file_llseek(file, offset, whence);
mutex_unlock(&inode->i_mutex);

return retval;
Expand Down
10 changes: 5 additions & 5 deletions fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,34 @@
* gfs2_llseek - seek to a location in a file
* @file: the file
* @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
* file's size.
*
* 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_holder i_gh;
loff_t error;

switch (origin) {
switch (whence) {
case SEEK_END: /* These reference inode->i_size */
case SEEK_DATA:
case SEEK_HOLE:
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
&i_gh);
if (!error) {
error = generic_file_llseek(file, offset, origin);
error = generic_file_llseek(file, offset, whence);
gfs2_glock_dq_uninit(&i_gh);
}
break;
case SEEK_CUR:
case SEEK_SET:
error = generic_file_llseek(file, offset, origin);
error = generic_file_llseek(file, offset, whence);
break;
default:
error = -EINVAL;
Expand Down
4 changes: 2 additions & 2 deletions fs/libfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ int dcache_dir_close(struct inode *inode, struct file *file)
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;
mutex_lock(&dentry->d_inode->i_mutex);
switch (origin) {
switch (whence) {
case 1:
offset += file->f_pos;
case 0:
Expand Down
Loading

0 comments on commit 965c8e5

Please sign in to comment.