aboutsummaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 113386d6fd2d..74e36586e4d3 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -97,6 +97,23 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int origin)
97} 97}
98EXPORT_SYMBOL(generic_file_llseek); 98EXPORT_SYMBOL(generic_file_llseek);
99 99
100/**
101 * noop_llseek - No Operation Performed llseek implementation
102 * @file: file structure to seek on
103 * @offset: file offset to seek to
104 * @origin: type of seek
105 *
106 * This is an implementation of ->llseek useable for the rare special case when
107 * userspace expects the seek to succeed but the (device) file is actually not
108 * able to perform the seek. In this case you use noop_llseek() instead of
109 * falling back to the default implementation of ->llseek.
110 */
111loff_t noop_llseek(struct file *file, loff_t offset, int origin)
112{
113 return file->f_pos;
114}
115EXPORT_SYMBOL(noop_llseek);
116
100loff_t no_llseek(struct file *file, loff_t offset, int origin) 117loff_t no_llseek(struct file *file, loff_t offset, int origin)
101{ 118{
102 return -ESPIPE; 119 return -ESPIPE;
@@ -294,7 +311,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
294 else 311 else
295 ret = do_sync_read(file, buf, count, pos); 312 ret = do_sync_read(file, buf, count, pos);
296 if (ret > 0) { 313 if (ret > 0) {
297 fsnotify_access(file->f_path.dentry); 314 fsnotify_access(file);
298 add_rchar(current, ret); 315 add_rchar(current, ret);
299 } 316 }
300 inc_syscr(current); 317 inc_syscr(current);
@@ -350,7 +367,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
350 else 367 else
351 ret = do_sync_write(file, buf, count, pos); 368 ret = do_sync_write(file, buf, count, pos);
352 if (ret > 0) { 369 if (ret > 0) {
353 fsnotify_modify(file->f_path.dentry); 370 fsnotify_modify(file);
354 add_wchar(current, ret); 371 add_wchar(current, ret);
355 } 372 }
356 inc_syscw(current); 373 inc_syscw(current);
@@ -658,9 +675,9 @@ out:
658 kfree(iov); 675 kfree(iov);
659 if ((ret + (type == READ)) > 0) { 676 if ((ret + (type == READ)) > 0) {
660 if (type == READ) 677 if (type == READ)
661 fsnotify_access(file->f_path.dentry); 678 fsnotify_access(file);
662 else 679 else
663 fsnotify_modify(file->f_path.dentry); 680 fsnotify_modify(file);
664 } 681 }
665 return ret; 682 return ret;
666} 683}