Commit 965c8e59cfcf845ecde2265a1d1bfee5f011d302

Authored by Andrew Morton
Committed by Linus Torvalds
1 parent c0f041602c

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>

Showing 26 changed files with 116 additions and 116 deletions Side-by-side Diff

... ... @@ -16,7 +16,7 @@
16 16 #include <linux/poll.h>
17 17  
18 18  
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)
20 20 {
21 21 return -EIO;
22 22 }
... ... @@ -321,7 +321,7 @@
321 321 * for a block special file file->f_path.dentry->d_inode->i_size is zero
322 322 * so we compute the size by hand (just as in block_read/write above)
323 323 */
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)
325 325 {
326 326 struct inode *bd_inode = file->f_mapping->host;
327 327 loff_t size;
... ... @@ -331,7 +331,7 @@
331 331 size = i_size_read(bd_inode);
332 332  
333 333 retval = -EINVAL;
334   - switch (origin) {
  334 + switch (whence) {
335 335 case SEEK_END:
336 336 offset += size;
337 337 break;
... ... @@ -2120,7 +2120,7 @@
2120 2120 return ret;
2121 2121 }
2122 2122  
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)
2124 2124 {
2125 2125 struct btrfs_root *root = BTRFS_I(inode)->root;
2126 2126 struct extent_map *em;
... ... @@ -2154,7 +2154,7 @@
2154 2154 * before the position we want in case there is outstanding delalloc
2155 2155 * going on here.
2156 2156 */
2157   - if (origin == SEEK_HOLE && start != 0) {
  2157 + if (whence == SEEK_HOLE && start != 0) {
2158 2158 if (start <= root->sectorsize)
2159 2159 em = btrfs_get_extent_fiemap(inode, NULL, 0, 0,
2160 2160 root->sectorsize, 0);
2161 2161  
... ... @@ -2188,13 +2188,13 @@
2188 2188 }
2189 2189 }
2190 2190  
2191   - if (origin == SEEK_HOLE) {
  2191 + if (whence == SEEK_HOLE) {
2192 2192 *offset = start;
2193 2193 free_extent_map(em);
2194 2194 break;
2195 2195 }
2196 2196 } else {
2197   - if (origin == SEEK_DATA) {
  2197 + if (whence == SEEK_DATA) {
2198 2198 if (em->block_start == EXTENT_MAP_DELALLOC) {
2199 2199 if (start >= inode->i_size) {
2200 2200 free_extent_map(em);
2201 2201  
2202 2202  
... ... @@ -2231,16 +2231,16 @@
2231 2231 return ret;
2232 2232 }
2233 2233  
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)
2235 2235 {
2236 2236 struct inode *inode = file->f_mapping->host;
2237 2237 int ret;
2238 2238  
2239 2239 mutex_lock(&inode->i_mutex);
2240   - switch (origin) {
  2240 + switch (whence) {
2241 2241 case SEEK_END:
2242 2242 case SEEK_CUR:
2243   - offset = generic_file_llseek(file, offset, origin);
  2243 + offset = generic_file_llseek(file, offset, whence);
2244 2244 goto out;
2245 2245 case SEEK_DATA:
2246 2246 case SEEK_HOLE:
... ... @@ -2249,7 +2249,7 @@
2249 2249 return -ENXIO;
2250 2250 }
2251 2251  
2252   - ret = find_desired_extent(inode, &offset, origin);
  2252 + ret = find_desired_extent(inode, &offset, whence);
2253 2253 if (ret) {
2254 2254 mutex_unlock(&inode->i_mutex);
2255 2255 return ret;
... ... @@ -454,7 +454,7 @@
454 454 fi->flags &= ~CEPH_F_ATEND;
455 455 }
456 456  
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)
458 458 {
459 459 struct ceph_file_info *fi = file->private_data;
460 460 struct inode *inode = file->f_mapping->host;
... ... @@ -463,7 +463,7 @@
463 463  
464 464 mutex_lock(&inode->i_mutex);
465 465 retval = -EINVAL;
466   - switch (origin) {
  466 + switch (whence) {
467 467 case SEEK_END:
468 468 offset += inode->i_size + 2; /* FIXME */
469 469 break;
... ... @@ -797,7 +797,7 @@
797 797 /*
798 798 * llseek. be sure to verify file size on SEEK_END.
799 799 */
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)
801 801 {
802 802 struct inode *inode = file->f_mapping->host;
803 803 int ret;
... ... @@ -805,7 +805,7 @@
805 805 mutex_lock(&inode->i_mutex);
806 806 __ceph_do_pending_vmtruncate(inode);
807 807  
808   - if (origin == SEEK_END || origin == SEEK_DATA || origin == SEEK_HOLE) {
  808 + if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) {
809 809 ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE);
810 810 if (ret < 0) {
811 811 offset = ret;
... ... @@ -813,7 +813,7 @@
813 813 }
814 814 }
815 815  
816   - switch (origin) {
  816 + switch (whence) {
817 817 case SEEK_END:
818 818 offset += inode->i_size;
819 819 break;
... ... @@ -695,13 +695,13 @@
695 695 return written;
696 696 }
697 697  
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)
699 699 {
700 700 /*
701   - * origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
  701 + * whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
702 702 * the cached file length
703 703 */
704   - if (origin != SEEK_SET && origin != SEEK_CUR) {
  704 + if (whence != SEEK_SET && whence != SEEK_CUR) {
705 705 int rc;
706 706 struct inode *inode = file->f_path.dentry->d_inode;
707 707  
... ... @@ -728,7 +728,7 @@
728 728 if (rc < 0)
729 729 return (loff_t)rc;
730 730 }
731   - return generic_file_llseek(file, offset, origin);
  731 + return generic_file_llseek(file, offset, whence);
732 732 }
733 733  
734 734 static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
... ... @@ -1613,12 +1613,12 @@
1613 1613 return 0;
1614 1614 }
1615 1615  
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)
1617 1617 {
1618 1618 struct dentry * dentry = file->f_path.dentry;
1619 1619  
1620 1620 mutex_lock(&dentry->d_inode->i_mutex);
1621   - switch (origin) {
  1621 + switch (whence) {
1622 1622 case 1:
1623 1623 offset += file->f_pos;
1624 1624 case 0:
... ... @@ -296,17 +296,17 @@
296 296 * NOTE: offsets obtained *before* ext3_set_inode_flag(dir, EXT3_INODE_INDEX)
297 297 * will be invalid once the directory was converted into a dx directory
298 298 */
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)
300 300 {
301 301 struct inode *inode = file->f_mapping->host;
302 302 int dx_dir = is_dx_dir(inode);
303 303 loff_t htree_max = ext3_get_htree_eof(file);
304 304  
305 305 if (likely(dx_dir))
306   - return generic_file_llseek_size(file, offset, origin,
  306 + return generic_file_llseek_size(file, offset, whence,
307 307 htree_max, htree_max);
308 308 else
309   - return generic_file_llseek(file, offset, origin);
  309 + return generic_file_llseek(file, offset, whence);
310 310 }
311 311  
312 312 /*
... ... @@ -333,17 +333,17 @@
333 333 *
334 334 * For non-htree, ext4_llseek already chooses the proper max offset.
335 335 */
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)
337 337 {
338 338 struct inode *inode = file->f_mapping->host;
339 339 int dx_dir = is_dx_dir(inode);
340 340 loff_t htree_max = ext4_get_htree_eof(file);
341 341  
342 342 if (likely(dx_dir))
343   - return generic_file_llseek_size(file, offset, origin,
  343 + return generic_file_llseek_size(file, offset, whence,
344 344 htree_max, htree_max);
345 345 else
346   - return ext4_llseek(file, offset, origin);
  346 + return ext4_llseek(file, offset, whence);
347 347 }
348 348  
349 349 /*
... ... @@ -303,7 +303,7 @@
303 303 * page cache has data or not.
304 304 */
305 305 static int ext4_find_unwritten_pgoff(struct inode *inode,
306   - int origin,
  306 + int whence,
307 307 struct ext4_map_blocks *map,
308 308 loff_t *offset)
309 309 {
310 310  
... ... @@ -333,10 +333,10 @@
333 333 nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,
334 334 (pgoff_t)num);
335 335 if (nr_pages == 0) {
336   - if (origin == SEEK_DATA)
  336 + if (whence == SEEK_DATA)
337 337 break;
338 338  
339   - BUG_ON(origin != SEEK_HOLE);
  339 + BUG_ON(whence != SEEK_HOLE);
340 340 /*
341 341 * If this is the first time to go into the loop and
342 342 * offset is not beyond the end offset, it will be a
... ... @@ -352,7 +352,7 @@
352 352 * offset is smaller than the first page offset, it will be a
353 353 * hole at this offset.
354 354 */
355   - if (lastoff == startoff && origin == SEEK_HOLE &&
  355 + if (lastoff == startoff && whence == SEEK_HOLE &&
356 356 lastoff < page_offset(pvec.pages[0])) {
357 357 found = 1;
358 358 break;
... ... @@ -366,7 +366,7 @@
366 366 * If the current offset is not beyond the end of given
367 367 * range, it will be a hole.
368 368 */
369   - if (lastoff < endoff && origin == SEEK_HOLE &&
  369 + if (lastoff < endoff && whence == SEEK_HOLE &&
370 370 page->index > end) {
371 371 found = 1;
372 372 *offset = lastoff;
373 373  
... ... @@ -391,10 +391,10 @@
391 391 do {
392 392 if (buffer_uptodate(bh) ||
393 393 buffer_unwritten(bh)) {
394   - if (origin == SEEK_DATA)
  394 + if (whence == SEEK_DATA)
395 395 found = 1;
396 396 } else {
397   - if (origin == SEEK_HOLE)
  397 + if (whence == SEEK_HOLE)
398 398 found = 1;
399 399 }
400 400 if (found) {
... ... @@ -416,7 +416,7 @@
416 416 * The no. of pages is less than our desired, that would be a
417 417 * hole in there.
418 418 */
419   - if (nr_pages < num && origin == SEEK_HOLE) {
  419 + if (nr_pages < num && whence == SEEK_HOLE) {
420 420 found = 1;
421 421 *offset = lastoff;
422 422 break;
... ... @@ -609,7 +609,7 @@
609 609 * by calling generic_file_llseek_size() with the appropriate maxbytes
610 610 * value for each.
611 611 */
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)
613 613 {
614 614 struct inode *inode = file->f_mapping->host;
615 615 loff_t maxbytes;
616 616  
... ... @@ -619,11 +619,11 @@
619 619 else
620 620 maxbytes = inode->i_sb->s_maxbytes;
621 621  
622   - switch (origin) {
  622 + switch (whence) {
623 623 case SEEK_SET:
624 624 case SEEK_CUR:
625 625 case SEEK_END:
626   - return generic_file_llseek_size(file, offset, origin,
  626 + return generic_file_llseek_size(file, offset, whence,
627 627 maxbytes, i_size_read(inode));
628 628 case SEEK_DATA:
629 629 return ext4_seek_data(file, offset, maxbytes);
... ... @@ -1599,19 +1599,19 @@
1599 1599 return err ? 0 : outarg.block;
1600 1600 }
1601 1601  
1602   -static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
  1602 +static loff_t fuse_file_llseek(struct file *file, loff_t offset, int whence)
1603 1603 {
1604 1604 loff_t retval;
1605 1605 struct inode *inode = file->f_path.dentry->d_inode;
1606 1606  
1607 1607 /* No i_mutex protection necessary for SEEK_CUR and SEEK_SET */
1608   - if (origin == SEEK_CUR || origin == SEEK_SET)
1609   - return generic_file_llseek(file, offset, origin);
  1608 + if (whence == SEEK_CUR || whence == SEEK_SET)
  1609 + return generic_file_llseek(file, offset, whence);
1610 1610  
1611 1611 mutex_lock(&inode->i_mutex);
1612 1612 retval = fuse_update_attributes(inode, NULL, file, NULL);
1613 1613 if (!retval)
1614   - retval = generic_file_llseek(file, offset, origin);
  1614 + retval = generic_file_llseek(file, offset, whence);
1615 1615 mutex_unlock(&inode->i_mutex);
1616 1616  
1617 1617 return retval;
... ... @@ -44,7 +44,7 @@
44 44 * gfs2_llseek - seek to a location in a file
45 45 * @file: the file
46 46 * @offset: the offset
47   - * @origin: Where to seek from (SEEK_SET, SEEK_CUR, or SEEK_END)
  47 + * @whence: Where to seek from (SEEK_SET, SEEK_CUR, or SEEK_END)
48 48 *
49 49 * SEEK_END requires the glock for the file because it references the
50 50 * file's size.
51 51  
52 52  
53 53  
... ... @@ -52,26 +52,26 @@
52 52 * Returns: The new offset, or errno
53 53 */
54 54  
55   -static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin)
  55 +static loff_t gfs2_llseek(struct file *file, loff_t offset, int whence)
56 56 {
57 57 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
58 58 struct gfs2_holder i_gh;
59 59 loff_t error;
60 60  
61   - switch (origin) {
  61 + switch (whence) {
62 62 case SEEK_END: /* These reference inode->i_size */
63 63 case SEEK_DATA:
64 64 case SEEK_HOLE:
65 65 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
66 66 &i_gh);
67 67 if (!error) {
68   - error = generic_file_llseek(file, offset, origin);
  68 + error = generic_file_llseek(file, offset, whence);
69 69 gfs2_glock_dq_uninit(&i_gh);
70 70 }
71 71 break;
72 72 case SEEK_CUR:
73 73 case SEEK_SET:
74   - error = generic_file_llseek(file, offset, origin);
  74 + error = generic_file_llseek(file, offset, whence);
75 75 break;
76 76 default:
77 77 error = -EINVAL;
... ... @@ -81,11 +81,11 @@
81 81 return 0;
82 82 }
83 83  
84   -loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
  84 +loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
85 85 {
86 86 struct dentry *dentry = file->f_path.dentry;
87 87 mutex_lock(&dentry->d_inode->i_mutex);
88   - switch (origin) {
  88 + switch (whence) {
89 89 case 1:
90 90 offset += file->f_pos;
91 91 case 0:
... ... @@ -871,7 +871,7 @@
871 871 return res;
872 872 }
873 873  
874   -static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
  874 +static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
875 875 {
876 876 struct dentry *dentry = filp->f_path.dentry;
877 877 struct inode *inode = dentry->d_inode;
878 878  
... ... @@ -880,10 +880,10 @@
880 880 dfprintk(FILE, "NFS: llseek dir(%s/%s, %lld, %d)\n",
881 881 dentry->d_parent->d_name.name,
882 882 dentry->d_name.name,
883   - offset, origin);
  883 + offset, whence);
884 884  
885 885 mutex_lock(&inode->i_mutex);
886   - switch (origin) {
  886 + switch (whence) {
887 887 case 1:
888 888 offset += filp->f_pos;
889 889 case 0:
... ... @@ -119,18 +119,18 @@
119 119 return __nfs_revalidate_inode(server, inode);
120 120 }
121 121  
122   -loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
  122 +loff_t nfs_file_llseek(struct file *filp, loff_t offset, int whence)
123 123 {
124 124 dprintk("NFS: llseek file(%s/%s, %lld, %d)\n",
125 125 filp->f_path.dentry->d_parent->d_name.name,
126 126 filp->f_path.dentry->d_name.name,
127   - offset, origin);
  127 + offset, whence);
128 128  
129 129 /*
130   - * origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
  130 + * whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
131 131 * the cached file length
132 132 */
133   - if (origin != SEEK_SET && origin != SEEK_CUR) {
  133 + if (whence != SEEK_SET && whence != SEEK_CUR) {
134 134 struct inode *inode = filp->f_mapping->host;
135 135  
136 136 int retval = nfs_revalidate_file_size(inode, filp);
... ... @@ -138,7 +138,7 @@
138 138 return (loff_t)retval;
139 139 }
140 140  
141   - return generic_file_llseek(filp, offset, origin);
  141 + return generic_file_llseek(filp, offset, whence);
142 142 }
143 143 EXPORT_SYMBOL_GPL(nfs_file_llseek);
144 144  
fs/ocfs2/extent_map.c
... ... @@ -832,7 +832,7 @@
832 832 return ret;
833 833 }
834 834  
835   -int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin)
  835 +int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int whence)
836 836 {
837 837 struct inode *inode = file->f_mapping->host;
838 838 int ret;
... ... @@ -843,7 +843,7 @@
843 843 struct buffer_head *di_bh = NULL;
844 844 struct ocfs2_extent_rec rec;
845 845  
846   - BUG_ON(origin != SEEK_DATA && origin != SEEK_HOLE);
  846 + BUG_ON(whence != SEEK_DATA && whence != SEEK_HOLE);
847 847  
848 848 ret = ocfs2_inode_lock(inode, &di_bh, 0);
849 849 if (ret) {
... ... @@ -859,7 +859,7 @@
859 859 }
860 860  
861 861 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
862   - if (origin == SEEK_HOLE)
  862 + if (whence == SEEK_HOLE)
863 863 *offset = inode->i_size;
864 864 goto out_unlock;
865 865 }
... ... @@ -888,8 +888,8 @@
888 888 is_data = (rec.e_flags & OCFS2_EXT_UNWRITTEN) ? 0 : 1;
889 889 }
890 890  
891   - if ((!is_data && origin == SEEK_HOLE) ||
892   - (is_data && origin == SEEK_DATA)) {
  891 + if ((!is_data && whence == SEEK_HOLE) ||
  892 + (is_data && whence == SEEK_DATA)) {
893 893 if (extoff > *offset)
894 894 *offset = extoff;
895 895 goto out_unlock;
... ... @@ -899,7 +899,7 @@
899 899 cpos += clen;
900 900 }
901 901  
902   - if (origin == SEEK_HOLE) {
  902 + if (whence == SEEK_HOLE) {
903 903 extoff = cpos;
904 904 extoff <<= cs_bits;
905 905 extlen = clen;
... ... @@ -2637,14 +2637,14 @@
2637 2637 }
2638 2638  
2639 2639 /* Refer generic_file_llseek_unlocked() */
2640   -static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int origin)
  2640 +static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int whence)
2641 2641 {
2642 2642 struct inode *inode = file->f_mapping->host;
2643 2643 int ret = 0;
2644 2644  
2645 2645 mutex_lock(&inode->i_mutex);
2646 2646  
2647   - switch (origin) {
  2647 + switch (whence) {
2648 2648 case SEEK_SET:
2649 2649 break;
2650 2650 case SEEK_END:
... ... @@ -2659,7 +2659,7 @@
2659 2659 break;
2660 2660 case SEEK_DATA:
2661 2661 case SEEK_HOLE:
2662   - ret = ocfs2_seek_data_hole_offset(file, &offset, origin);
  2662 + ret = ocfs2_seek_data_hole_offset(file, &offset, whence);
2663 2663 if (ret)
2664 2664 goto out;
2665 2665 break;
... ... @@ -151,13 +151,13 @@
151 151 return 0;
152 152 }
153 153  
154   -static loff_t pstore_file_llseek(struct file *file, loff_t off, int origin)
  154 +static loff_t pstore_file_llseek(struct file *file, loff_t off, int whence)
155 155 {
156 156 struct seq_file *sf = file->private_data;
157 157  
158 158 if (sf->op)
159   - return seq_lseek(file, off, origin);
160   - return default_llseek(file, off, origin);
  159 + return seq_lseek(file, off, whence);
  160 + return default_llseek(file, off, whence);
161 161 }
162 162  
163 163 static const struct file_operations pstore_file_operations = {
... ... @@ -54,7 +54,7 @@
54 54 * generic_file_llseek_size - generic llseek implementation for regular files
55 55 * @file: file structure to seek on
56 56 * @offset: file offset to seek to
57   - * @origin: type of seek
  57 + * @whence: type of seek
58 58 * @size: max size of this file in file system
59 59 * @eof: offset used for SEEK_END position
60 60 *
61 61  
... ... @@ -67,12 +67,12 @@
67 67 * read/writes behave like SEEK_SET against seeks.
68 68 */
69 69 loff_t
70   -generic_file_llseek_size(struct file *file, loff_t offset, int origin,
  70 +generic_file_llseek_size(struct file *file, loff_t offset, int whence,
71 71 loff_t maxsize, loff_t eof)
72 72 {
73 73 struct inode *inode = file->f_mapping->host;
74 74  
75   - switch (origin) {
  75 + switch (whence) {
76 76 case SEEK_END:
77 77 offset += eof;
78 78 break;
79 79  
80 80  
81 81  
... ... @@ -122,17 +122,17 @@
122 122 * generic_file_llseek - generic llseek implementation for regular files
123 123 * @file: file structure to seek on
124 124 * @offset: file offset to seek to
125   - * @origin: type of seek
  125 + * @whence: type of seek
126 126 *
127 127 * This is a generic implemenation of ->llseek useable for all normal local
128 128 * filesystems. It just updates the file offset to the value specified by
129   - * @offset and @origin under i_mutex.
  129 + * @offset and @whence under i_mutex.
130 130 */
131   -loff_t generic_file_llseek(struct file *file, loff_t offset, int origin)
  131 +loff_t generic_file_llseek(struct file *file, loff_t offset, int whence)
132 132 {
133 133 struct inode *inode = file->f_mapping->host;
134 134  
135   - return generic_file_llseek_size(file, offset, origin,
  135 + return generic_file_llseek_size(file, offset, whence,
136 136 inode->i_sb->s_maxbytes,
137 137 i_size_read(inode));
138 138 }
139 139  
140 140  
141 141  
142 142  
... ... @@ -142,32 +142,32 @@
142 142 * noop_llseek - No Operation Performed llseek implementation
143 143 * @file: file structure to seek on
144 144 * @offset: file offset to seek to
145   - * @origin: type of seek
  145 + * @whence: type of seek
146 146 *
147 147 * This is an implementation of ->llseek useable for the rare special case when
148 148 * userspace expects the seek to succeed but the (device) file is actually not
149 149 * able to perform the seek. In this case you use noop_llseek() instead of
150 150 * falling back to the default implementation of ->llseek.
151 151 */
152   -loff_t noop_llseek(struct file *file, loff_t offset, int origin)
  152 +loff_t noop_llseek(struct file *file, loff_t offset, int whence)
153 153 {
154 154 return file->f_pos;
155 155 }
156 156 EXPORT_SYMBOL(noop_llseek);
157 157  
158   -loff_t no_llseek(struct file *file, loff_t offset, int origin)
  158 +loff_t no_llseek(struct file *file, loff_t offset, int whence)
159 159 {
160 160 return -ESPIPE;
161 161 }
162 162 EXPORT_SYMBOL(no_llseek);
163 163  
164   -loff_t default_llseek(struct file *file, loff_t offset, int origin)
  164 +loff_t default_llseek(struct file *file, loff_t offset, int whence)
165 165 {
166 166 struct inode *inode = file->f_path.dentry->d_inode;
167 167 loff_t retval;
168 168  
169 169 mutex_lock(&inode->i_mutex);
170   - switch (origin) {
  170 + switch (whence) {
171 171 case SEEK_END:
172 172 offset += i_size_read(inode);
173 173 break;
... ... @@ -216,7 +216,7 @@
216 216 }
217 217 EXPORT_SYMBOL(default_llseek);
218 218  
219   -loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
  219 +loff_t vfs_llseek(struct file *file, loff_t offset, int whence)
220 220 {
221 221 loff_t (*fn)(struct file *, loff_t, int);
222 222  
223 223  
... ... @@ -225,11 +225,11 @@
225 225 if (file->f_op && file->f_op->llseek)
226 226 fn = file->f_op->llseek;
227 227 }
228   - return fn(file, offset, origin);
  228 + return fn(file, offset, whence);
229 229 }
230 230 EXPORT_SYMBOL(vfs_llseek);
231 231  
232   -SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin)
  232 +SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence)
233 233 {
234 234 off_t retval;
235 235 struct fd f = fdget(fd);
... ... @@ -237,8 +237,8 @@
237 237 return -EBADF;
238 238  
239 239 retval = -EINVAL;
240   - if (origin <= SEEK_MAX) {
241   - loff_t res = vfs_llseek(f.file, offset, origin);
  240 + if (whence <= SEEK_MAX) {
  241 + loff_t res = vfs_llseek(f.file, offset, whence);
242 242 retval = res;
243 243 if (res != (loff_t)retval)
244 244 retval = -EOVERFLOW; /* LFS: should only happen on 32 bit platforms */
... ... @@ -250,7 +250,7 @@
250 250 #ifdef __ARCH_WANT_SYS_LLSEEK
251 251 SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
252 252 unsigned long, offset_low, loff_t __user *, result,
253   - unsigned int, origin)
  253 + unsigned int, whence)
254 254 {
255 255 int retval;
256 256 struct fd f = fdget(fd);
257 257  
... ... @@ -260,11 +260,11 @@
260 260 return -EBADF;
261 261  
262 262 retval = -EINVAL;
263   - if (origin > SEEK_MAX)
  263 + if (whence > SEEK_MAX)
264 264 goto out_putf;
265 265  
266 266 offset = vfs_llseek(f.file, ((loff_t) offset_high << 32) | offset_low,
267   - origin);
  267 + whence);
268 268  
269 269 retval = (int)offset;
270 270 if (offset >= 0) {
... ... @@ -300,14 +300,14 @@
300 300 *
301 301 * Ready-made ->f_op->llseek()
302 302 */
303   -loff_t seq_lseek(struct file *file, loff_t offset, int origin)
  303 +loff_t seq_lseek(struct file *file, loff_t offset, int whence)
304 304 {
305 305 struct seq_file *m = file->private_data;
306 306 loff_t retval = -EINVAL;
307 307  
308 308 mutex_lock(&m->lock);
309 309 m->version = file->f_version;
310   - switch (origin) {
  310 + switch (whence) {
311 311 case 1:
312 312 offset += file->f_pos;
313 313 case 0:
... ... @@ -453,11 +453,11 @@
453 453 }
454 454  
455 455 /* If a directory is seeked, we have to free saved readdir() state */
456   -static loff_t ubifs_dir_llseek(struct file *file, loff_t offset, int origin)
  456 +static loff_t ubifs_dir_llseek(struct file *file, loff_t offset, int whence)
457 457 {
458 458 kfree(file->private_data);
459 459 file->private_data = NULL;
460   - return generic_file_llseek(file, offset, origin);
  460 + return generic_file_llseek(file, offset, whence);
461 461 }
462 462  
463 463 /* Free saved readdir() state when the directory is closed */
... ... @@ -2286,9 +2286,9 @@
2286 2286 #include <linux/err.h>
2287 2287  
2288 2288 /* needed for stackable file system support */
2289   -extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
  2289 +extern loff_t default_llseek(struct file *file, loff_t offset, int whence);
2290 2290  
2291   -extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
  2291 +extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
2292 2292  
2293 2293 extern int inode_init_always(struct super_block *, struct inode *);
2294 2294 extern void inode_init_once(struct inode *);
2295 2295  
... ... @@ -2396,11 +2396,11 @@
2396 2396  
2397 2397 extern void
2398 2398 file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2399   -extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
2400   -extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
2401   -extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
  2399 +extern loff_t noop_llseek(struct file *file, loff_t offset, int whence);
  2400 +extern loff_t no_llseek(struct file *file, loff_t offset, int whence);
  2401 +extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence);
2402 2402 extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,
2403   - int origin, loff_t maxsize, loff_t eof);
  2403 + int whence, loff_t maxsize, loff_t eof);
2404 2404 extern int generic_file_open(struct inode * inode, struct file * filp);
2405 2405 extern int nonseekable_open(struct inode * inode, struct file * filp);
2406 2406  
include/linux/ftrace.h
... ... @@ -394,7 +394,7 @@
394 394 size_t cnt, loff_t *ppos);
395 395 ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
396 396 size_t cnt, loff_t *ppos);
397   -loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin);
  397 +loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence);
398 398 int ftrace_regex_release(struct inode *inode, struct file *file);
399 399  
400 400 void __init
... ... @@ -559,7 +559,7 @@
559 559 size_t cnt, loff_t *ppos) { return -ENODEV; }
560 560 static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
561 561 size_t cnt, loff_t *ppos) { return -ENODEV; }
562   -static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin)
  562 +static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
563 563 {
564 564 return -ENODEV;
565 565 }
include/linux/syscalls.h
... ... @@ -560,10 +560,10 @@
560 560 asmlinkage long sys_utimes(char __user *filename,
561 561 struct timeval __user *utimes);
562 562 asmlinkage long sys_lseek(unsigned int fd, off_t offset,
563   - unsigned int origin);
  563 + unsigned int whence);
564 564 asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
565 565 unsigned long offset_low, loff_t __user *result,
566   - unsigned int origin);
  566 + unsigned int whence);
567 567 asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
568 568 asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
569 569 asmlinkage long sys_readv(unsigned long fd,
kernel/trace/ftrace.c
... ... @@ -2675,12 +2675,12 @@
2675 2675 }
2676 2676  
2677 2677 loff_t
2678   -ftrace_regex_lseek(struct file *file, loff_t offset, int origin)
  2678 +ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
2679 2679 {
2680 2680 loff_t ret;
2681 2681  
2682 2682 if (file->f_mode & FMODE_READ)
2683   - ret = seq_lseek(file, offset, origin);
  2683 + ret = seq_lseek(file, offset, whence);
2684 2684 else
2685 2685 file->f_pos = ret = 1;
2686 2686  
... ... @@ -1719,7 +1719,7 @@
1719 1719 * llseek SEEK_DATA or SEEK_HOLE through the radix_tree.
1720 1720 */
1721 1721 static pgoff_t shmem_seek_hole_data(struct address_space *mapping,
1722   - pgoff_t index, pgoff_t end, int origin)
  1722 + pgoff_t index, pgoff_t end, int whence)
1723 1723 {
1724 1724 struct page *page;
1725 1725 struct pagevec pvec;
1726 1726  
... ... @@ -1733,13 +1733,13 @@
1733 1733 pvec.nr = shmem_find_get_pages_and_swap(mapping, index,
1734 1734 pvec.nr, pvec.pages, indices);
1735 1735 if (!pvec.nr) {
1736   - if (origin == SEEK_DATA)
  1736 + if (whence == SEEK_DATA)
1737 1737 index = end;
1738 1738 break;
1739 1739 }
1740 1740 for (i = 0; i < pvec.nr; i++, index++) {
1741 1741 if (index < indices[i]) {
1742   - if (origin == SEEK_HOLE) {
  1742 + if (whence == SEEK_HOLE) {
1743 1743 done = true;
1744 1744 break;
1745 1745 }
... ... @@ -1751,8 +1751,8 @@
1751 1751 page = NULL;
1752 1752 }
1753 1753 if (index >= end ||
1754   - (page && origin == SEEK_DATA) ||
1755   - (!page && origin == SEEK_HOLE)) {
  1754 + (page && whence == SEEK_DATA) ||
  1755 + (!page && whence == SEEK_HOLE)) {
1756 1756 done = true;
1757 1757 break;
1758 1758 }
1759 1759  
... ... @@ -1765,15 +1765,15 @@
1765 1765 return index;
1766 1766 }
1767 1767  
1768   -static loff_t shmem_file_llseek(struct file *file, loff_t offset, int origin)
  1768 +static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence)
1769 1769 {
1770 1770 struct address_space *mapping = file->f_mapping;
1771 1771 struct inode *inode = mapping->host;
1772 1772 pgoff_t start, end;
1773 1773 loff_t new_offset;
1774 1774  
1775   - if (origin != SEEK_DATA && origin != SEEK_HOLE)
1776   - return generic_file_llseek_size(file, offset, origin,
  1775 + if (whence != SEEK_DATA && whence != SEEK_HOLE)
  1776 + return generic_file_llseek_size(file, offset, whence,
1777 1777 MAX_LFS_FILESIZE, i_size_read(inode));
1778 1778 mutex_lock(&inode->i_mutex);
1779 1779 /* We're holding i_mutex so we can access i_size directly */
1780 1780  
... ... @@ -1785,12 +1785,12 @@
1785 1785 else {
1786 1786 start = offset >> PAGE_CACHE_SHIFT;
1787 1787 end = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
1788   - new_offset = shmem_seek_hole_data(mapping, start, end, origin);
  1788 + new_offset = shmem_seek_hole_data(mapping, start, end, whence);
1789 1789 new_offset <<= PAGE_CACHE_SHIFT;
1790 1790 if (new_offset > offset) {
1791 1791 if (new_offset < inode->i_size)
1792 1792 offset = new_offset;
1793   - else if (origin == SEEK_DATA)
  1793 + else if (whence == SEEK_DATA)
1794 1794 offset = -ENXIO;
1795 1795 else
1796 1796 offset = inode->i_size;