patch-2.4.8 linux/fs/read_write.c
Next file: linux/fs/super.c
Previous file: linux/fs/proc/array.c
Back to the patch index
Back to the overall index
- Lines: 43
- Date:
Sun Aug 5 13:12:41 2001
- Orig file:
v2.4.7/linux/fs/read_write.c
- Orig date:
Tue Apr 17 14:36:44 2001
diff -u --recursive --new-file v2.4.7/linux/fs/read_write.c linux/fs/read_write.c
@@ -15,6 +15,7 @@
#include <asm/uaccess.h>
struct file_operations generic_ro_fops = {
+ llseek: generic_file_llseek,
read: generic_file_read,
mmap: generic_file_mmap,
};
@@ -22,6 +23,34 @@
ssize_t generic_read_dir(struct file *filp, char *buf, size_t siz, loff_t *ppos)
{
return -EISDIR;
+}
+
+loff_t generic_file_llseek(struct file *file, loff_t offset, int origin)
+{
+ long long retval;
+
+ switch (origin) {
+ case 2:
+ offset += file->f_dentry->d_inode->i_size;
+ break;
+ case 1:
+ offset += file->f_pos;
+ }
+ retval = -EINVAL;
+ if (offset>=0 && offset<=file->f_dentry->d_inode->i_sb->s_maxbytes) {
+ if (offset != file->f_pos) {
+ file->f_pos = offset;
+ file->f_reada = 0;
+ file->f_version = ++event;
+ }
+ retval = offset;
+ }
+ return retval;
+}
+
+loff_t no_llseek(struct file *file, loff_t offset, int origin)
+{
+ return -ESPIPE;
}
loff_t default_llseek(struct file *file, loff_t offset, int origin)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)