提交 7b8e8924 编写于 作者: C Chris Snook 提交者: Linus Torvalds

use symbolic constants in generic lseek code

Convert magic numbers to SEEK_* values from fs.h
Signed-off-by: NChris Snook <csnook@redhat.com>
Acked-by: NDavid Howells <dhowells@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 5b795202
...@@ -37,10 +37,10 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) ...@@ -37,10 +37,10 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int origin)
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
switch (origin) { switch (origin) {
case 2: case SEEK_END:
offset += inode->i_size; offset += inode->i_size;
break; break;
case 1: case SEEK_CUR:
offset += file->f_pos; offset += file->f_pos;
} }
retval = -EINVAL; retval = -EINVAL;
...@@ -63,10 +63,10 @@ loff_t remote_llseek(struct file *file, loff_t offset, int origin) ...@@ -63,10 +63,10 @@ loff_t remote_llseek(struct file *file, loff_t offset, int origin)
lock_kernel(); lock_kernel();
switch (origin) { switch (origin) {
case 2: case SEEK_END:
offset += i_size_read(file->f_path.dentry->d_inode); offset += i_size_read(file->f_path.dentry->d_inode);
break; break;
case 1: case SEEK_CUR:
offset += file->f_pos; offset += file->f_pos;
} }
retval = -EINVAL; retval = -EINVAL;
...@@ -94,10 +94,10 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin) ...@@ -94,10 +94,10 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin)
lock_kernel(); lock_kernel();
switch (origin) { switch (origin) {
case 2: case SEEK_END:
offset += i_size_read(file->f_path.dentry->d_inode); offset += i_size_read(file->f_path.dentry->d_inode);
break; break;
case 1: case SEEK_CUR:
offset += file->f_pos; offset += file->f_pos;
} }
retval = -EINVAL; retval = -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册