Skip to content

Commit 965c8e5

Browse files
akpm00torvalds
authored andcommitted
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>
1 parent c0f0416 commit 965c8e5

26 files changed

Lines changed: 116 additions & 116 deletions

File tree

‎fs/bad_inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <linux/poll.h>
1717

1818

19-
static loff_t bad_file_llseek(struct file *file, loff_t offset, int origin)
19+
static loff_t bad_file_llseek(struct file *file, loff_t offset, int whence)
2020
{
2121
return -EIO;
2222
}

‎fs/block_dev.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static int blkdev_write_end(struct file *file, struct address_space *mapping,
321321
* for a block special file file->f_path.dentry->d_inode->i_size is zero
322322
* so we compute the size by hand (just as in block_read/write above)
323323
*/
324-
static loff_t block_llseek(struct file *file, loff_t offset, int origin)
324+
static loff_t block_llseek(struct file *file, loff_t offset, int whence)
325325
{
326326
struct inode *bd_inode = file->f_mapping->host;
327327
loff_t size;
@@ -331,7 +331,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin)
331331
size = i_size_read(bd_inode);
332332

333333
retval = -EINVAL;
334-
switch (origin) {
334+
switch (whence) {
335335
case SEEK_END:
336336
offset += size;
337337
break;

‎fs/btrfs/file.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,7 +2120,7 @@ static long btrfs_fallocate(struct file *file, int mode,
21202120
return ret;
21212121
}
21222122

2123-
static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
2123+
static int find_desired_extent(struct inode *inode, loff_t *offset, int whence)
21242124
{
21252125
struct btrfs_root *root = BTRFS_I(inode)->root;
21262126
struct extent_map *em;
@@ -2154,7 +2154,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
21542154
* before the position we want in case there is outstanding delalloc
21552155
* going on here.
21562156
*/
2157-
if (origin == SEEK_HOLE && start != 0) {
2157+
if (whence == SEEK_HOLE && start != 0) {
21582158
if (start <= root->sectorsize)
21592159
em = btrfs_get_extent_fiemap(inode, NULL, 0, 0,
21602160
root->sectorsize, 0);
@@ -2188,13 +2188,13 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
21882188
}
21892189
}
21902190

2191-
if (origin == SEEK_HOLE) {
2191+
if (whence == SEEK_HOLE) {
21922192
*offset = start;
21932193
free_extent_map(em);
21942194
break;
21952195
}
21962196
} else {
2197-
if (origin == SEEK_DATA) {
2197+
if (whence == SEEK_DATA) {
21982198
if (em->block_start == EXTENT_MAP_DELALLOC) {
21992199
if (start >= inode->i_size) {
22002200
free_extent_map(em);
@@ -2231,16 +2231,16 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
22312231
return ret;
22322232
}
22332233

2234-
static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin)
2234+
static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence)
22352235
{
22362236
struct inode *inode = file->f_mapping->host;
22372237
int ret;
22382238

22392239
mutex_lock(&inode->i_mutex);
2240-
switch (origin) {
2240+
switch (whence) {
22412241
case SEEK_END:
22422242
case SEEK_CUR:
2243-
offset = generic_file_llseek(file, offset, origin);
2243+
offset = generic_file_llseek(file, offset, whence);
22442244
goto out;
22452245
case SEEK_DATA:
22462246
case SEEK_HOLE:
@@ -2249,7 +2249,7 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin)
22492249
return -ENXIO;
22502250
}
22512251

2252-
ret = find_desired_extent(inode, &offset, origin);
2252+
ret = find_desired_extent(inode, &offset, whence);
22532253
if (ret) {
22542254
mutex_unlock(&inode->i_mutex);
22552255
return ret;

‎fs/ceph/dir.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static void reset_readdir(struct ceph_file_info *fi)
454454
fi->flags &= ~CEPH_F_ATEND;
455455
}
456456

457-
static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin)
457+
static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence)
458458
{
459459
struct ceph_file_info *fi = file->private_data;
460460
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)
463463

464464
mutex_lock(&inode->i_mutex);
465465
retval = -EINVAL;
466-
switch (origin) {
466+
switch (whence) {
467467
case SEEK_END:
468468
offset += inode->i_size + 2; /* FIXME */
469469
break;

‎fs/ceph/file.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -797,23 +797,23 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
797797
/*
798798
* llseek. be sure to verify file size on SEEK_END.
799799
*/
800-
static loff_t ceph_llseek(struct file *file, loff_t offset, int origin)
800+
static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
801801
{
802802
struct inode *inode = file->f_mapping->host;
803803
int ret;
804804

805805
mutex_lock(&inode->i_mutex);
806806
__ceph_do_pending_vmtruncate(inode);
807807

808-
if (origin == SEEK_END || origin == SEEK_DATA || origin == SEEK_HOLE) {
808+
if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) {
809809
ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE);
810810
if (ret < 0) {
811811
offset = ret;
812812
goto out;
813813
}
814814
}
815815

816-
switch (origin) {
816+
switch (whence) {
817817
case SEEK_END:
818818
offset += inode->i_size;
819819
break;

‎fs/cifs/cifsfs.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,13 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
695695
return written;
696696
}
697697

698-
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
698+
static loff_t cifs_llseek(struct file *file, loff_t offset, int whence)
699699
{
700700
/*
701-
* origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
701+
* whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
702702
* the cached file length
703703
*/
704-
if (origin != SEEK_SET && origin != SEEK_CUR) {
704+
if (whence != SEEK_SET && whence != SEEK_CUR) {
705705
int rc;
706706
struct inode *inode = file->f_path.dentry->d_inode;
707707

@@ -728,7 +728,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
728728
if (rc < 0)
729729
return (loff_t)rc;
730730
}
731-
return generic_file_llseek(file, offset, origin);
731+
return generic_file_llseek(file, offset, whence);
732732
}
733733

734734
static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)

‎fs/configfs/dir.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,12 +1613,12 @@ static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir
16131613
return 0;
16141614
}
16151615

1616-
static loff_t configfs_dir_lseek(struct file * file, loff_t offset, int origin)
1616+
static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
16171617
{
16181618
struct dentry * dentry = file->f_path.dentry;
16191619

16201620
mutex_lock(&dentry->d_inode->i_mutex);
1621-
switch (origin) {
1621+
switch (whence) {
16221622
case 1:
16231623
offset += file->f_pos;
16241624
case 0:

‎fs/ext3/dir.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,17 +296,17 @@ static inline loff_t ext3_get_htree_eof(struct file *filp)
296296
* NOTE: offsets obtained *before* ext3_set_inode_flag(dir, EXT3_INODE_INDEX)
297297
* will be invalid once the directory was converted into a dx directory
298298
*/
299-
loff_t ext3_dir_llseek(struct file *file, loff_t offset, int origin)
299+
loff_t ext3_dir_llseek(struct file *file, loff_t offset, int whence)
300300
{
301301
struct inode *inode = file->f_mapping->host;
302302
int dx_dir = is_dx_dir(inode);
303303
loff_t htree_max = ext3_get_htree_eof(file);
304304

305305
if (likely(dx_dir))
306-
return generic_file_llseek_size(file, offset, origin,
306+
return generic_file_llseek_size(file, offset, whence,
307307
htree_max, htree_max);
308308
else
309-
return generic_file_llseek(file, offset, origin);
309+
return generic_file_llseek(file, offset, whence);
310310
}
311311

312312
/*

‎fs/ext4/dir.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,17 @@ static inline loff_t ext4_get_htree_eof(struct file *filp)
333333
*
334334
* For non-htree, ext4_llseek already chooses the proper max offset.
335335
*/
336-
loff_t ext4_dir_llseek(struct file *file, loff_t offset, int origin)
336+
loff_t ext4_dir_llseek(struct file *file, loff_t offset, int whence)
337337
{
338338
struct inode *inode = file->f_mapping->host;
339339
int dx_dir = is_dx_dir(inode);
340340
loff_t htree_max = ext4_get_htree_eof(file);
341341

342342
if (likely(dx_dir))
343-
return generic_file_llseek_size(file, offset, origin,
343+
return generic_file_llseek_size(file, offset, whence,
344344
htree_max, htree_max);
345345
else
346-
return ext4_llseek(file, offset, origin);
346+
return ext4_llseek(file, offset, whence);
347347
}
348348

349349
/*

‎fs/ext4/file.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
303303
* page cache has data or not.
304304
*/
305305
static int ext4_find_unwritten_pgoff(struct inode *inode,
306-
int origin,
306+
int whence,
307307
struct ext4_map_blocks *map,
308308
loff_t *offset)
309309
{
@@ -333,10 +333,10 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
333333
nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,
334334
(pgoff_t)num);
335335
if (nr_pages == 0) {
336-
if (origin == SEEK_DATA)
336+
if (whence == SEEK_DATA)
337337
break;
338338

339-
BUG_ON(origin != SEEK_HOLE);
339+
BUG_ON(whence != SEEK_HOLE);
340340
/*
341341
* If this is the first time to go into the loop and
342342
* offset is not beyond the end offset, it will be a
@@ -352,7 +352,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
352352
* offset is smaller than the first page offset, it will be a
353353
* hole at this offset.
354354
*/
355-
if (lastoff == startoff && origin == SEEK_HOLE &&
355+
if (lastoff == startoff && whence == SEEK_HOLE &&
356356
lastoff < page_offset(pvec.pages[0])) {
357357
found = 1;
358358
break;
@@ -366,7 +366,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
366366
* If the current offset is not beyond the end of given
367367
* range, it will be a hole.
368368
*/
369-
if (lastoff < endoff && origin == SEEK_HOLE &&
369+
if (lastoff < endoff && whence == SEEK_HOLE &&
370370
page->index > end) {
371371
found = 1;
372372
*offset = lastoff;
@@ -391,10 +391,10 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
391391
do {
392392
if (buffer_uptodate(bh) ||
393393
buffer_unwritten(bh)) {
394-
if (origin == SEEK_DATA)
394+
if (whence == SEEK_DATA)
395395
found = 1;
396396
} else {
397-
if (origin == SEEK_HOLE)
397+
if (whence == SEEK_HOLE)
398398
found = 1;
399399
}
400400
if (found) {
@@ -416,7 +416,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
416416
* The no. of pages is less than our desired, that would be a
417417
* hole in there.
418418
*/
419-
if (nr_pages < num && origin == SEEK_HOLE) {
419+
if (nr_pages < num && whence == SEEK_HOLE) {
420420
found = 1;
421421
*offset = lastoff;
422422
break;
@@ -609,7 +609,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
609609
* by calling generic_file_llseek_size() with the appropriate maxbytes
610610
* value for each.
611611
*/
612-
loff_t ext4_llseek(struct file *file, loff_t offset, int origin)
612+
loff_t ext4_llseek(struct file *file, loff_t offset, int whence)
613613
{
614614
struct inode *inode = file->f_mapping->host;
615615
loff_t maxbytes;
@@ -619,11 +619,11 @@ loff_t ext4_llseek(struct file *file, loff_t offset, int origin)
619619
else
620620
maxbytes = inode->i_sb->s_maxbytes;
621621

622-
switch (origin) {
622+
switch (whence) {
623623
case SEEK_SET:
624624
case SEEK_CUR:
625625
case SEEK_END:
626-
return generic_file_llseek_size(file, offset, origin,
626+
return generic_file_llseek_size(file, offset, whence,
627627
maxbytes, i_size_read(inode));
628628
case SEEK_DATA:
629629
return ext4_seek_data(file, offset, maxbytes);

0 commit comments

Comments
 (0)