file.c (41be702a542a0d14bb0b1c16e824fa9ed27616ec) file.c (027978295d455b2fdff0cb36570f83ada7385ea6)
1/**
2 * eCryptfs: Linux filesystem encryption layer
3 *
4 * Copyright (C) 1997-2004 Erez Zadok
5 * Copyright (C) 2001-2004 Stony Brook University
6 * Copyright (C) 2004-2007 International Business Machines Corp.
7 * Author(s): Michael A. Halcrow <mhalcrow@us.ibm.com>
8 * Michael C. Thompson <mcthomps@us.ibm.com>

--- 31 unchanged lines hidden (view full) ---

40 * generic_file_read updates the atime of upper layer inode. But, it
41 * doesn't give us a chance to update the atime of the lower layer
42 * inode. This function is a wrapper to generic_file_read. It
43 * updates the atime of the lower level inode if generic_file_read
44 * returns without any errors. This is to be used only for file reads.
45 * The function to be used for directory reads is ecryptfs_read.
46 */
47static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb,
1/**
2 * eCryptfs: Linux filesystem encryption layer
3 *
4 * Copyright (C) 1997-2004 Erez Zadok
5 * Copyright (C) 2001-2004 Stony Brook University
6 * Copyright (C) 2004-2007 International Business Machines Corp.
7 * Author(s): Michael A. Halcrow <mhalcrow@us.ibm.com>
8 * Michael C. Thompson <mcthomps@us.ibm.com>

--- 31 unchanged lines hidden (view full) ---

40 * generic_file_read updates the atime of upper layer inode. But, it
41 * doesn't give us a chance to update the atime of the lower layer
42 * inode. This function is a wrapper to generic_file_read. It
43 * updates the atime of the lower level inode if generic_file_read
44 * returns without any errors. This is to be used only for file reads.
45 * The function to be used for directory reads is ecryptfs_read.
46 */
47static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb,
48 const struct iovec *iov,
49 unsigned long nr_segs, loff_t pos)
48 struct iov_iter *to)
50{
51 ssize_t rc;
52 struct path *path;
53 struct file *file = iocb->ki_filp;
54
49{
50 ssize_t rc;
51 struct path *path;
52 struct file *file = iocb->ki_filp;
53
55 rc = generic_file_aio_read(iocb, iov, nr_segs, pos);
54 rc = generic_file_read_iter(iocb, to);
56 /*
57 * Even though this is a async interface, we need to wait
58 * for IO to finish to update atime
59 */
60 if (-EIOCBQUEUED == rc)
61 rc = wait_on_sync_kiocb(iocb);
62 if (rc >= 0) {
63 path = ecryptfs_dentry_to_lower_path(file->f_path.dentry);

--- 283 unchanged lines hidden (view full) ---

347 .fsync = ecryptfs_fsync,
348 .fasync = ecryptfs_fasync,
349 .splice_read = generic_file_splice_read,
350 .llseek = default_llseek,
351};
352
353const struct file_operations ecryptfs_main_fops = {
354 .llseek = generic_file_llseek,
55 /*
56 * Even though this is a async interface, we need to wait
57 * for IO to finish to update atime
58 */
59 if (-EIOCBQUEUED == rc)
60 rc = wait_on_sync_kiocb(iocb);
61 if (rc >= 0) {
62 path = ecryptfs_dentry_to_lower_path(file->f_path.dentry);

--- 283 unchanged lines hidden (view full) ---

346 .fsync = ecryptfs_fsync,
347 .fasync = ecryptfs_fasync,
348 .splice_read = generic_file_splice_read,
349 .llseek = default_llseek,
350};
351
352const struct file_operations ecryptfs_main_fops = {
353 .llseek = generic_file_llseek,
355 .read = do_sync_read,
356 .aio_read = ecryptfs_read_update_atime,
354 .read = new_sync_read,
355 .read_iter = ecryptfs_read_update_atime,
357 .write = do_sync_write,
358 .aio_write = generic_file_aio_write,
359 .iterate = ecryptfs_readdir,
360 .unlocked_ioctl = ecryptfs_unlocked_ioctl,
361#ifdef CONFIG_COMPAT
362 .compat_ioctl = ecryptfs_compat_ioctl,
363#endif
364 .mmap = generic_file_mmap,
365 .open = ecryptfs_open,
366 .flush = ecryptfs_flush,
367 .release = ecryptfs_release,
368 .fsync = ecryptfs_fsync,
369 .fasync = ecryptfs_fasync,
370 .splice_read = generic_file_splice_read,
371};
356 .write = do_sync_write,
357 .aio_write = generic_file_aio_write,
358 .iterate = ecryptfs_readdir,
359 .unlocked_ioctl = ecryptfs_unlocked_ioctl,
360#ifdef CONFIG_COMPAT
361 .compat_ioctl = ecryptfs_compat_ioctl,
362#endif
363 .mmap = generic_file_mmap,
364 .open = ecryptfs_open,
365 .flush = ecryptfs_flush,
366 .release = ecryptfs_release,
367 .fsync = ecryptfs_fsync,
368 .fasync = ecryptfs_fasync,
369 .splice_read = generic_file_splice_read,
370};