file.c (4f2c0a4acffbec01079c28f839422e64ddeff004) file.c (390df3b830e758e970a0ba928a97f8bbd5385f0c)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * eCryptfs: Linux filesystem encryption layer
4 *
5 * Copyright (C) 1997-2004 Erez Zadok
6 * Copyright (C) 2001-2004 Stony Brook University
7 * Copyright (C) 2004-2007 International Business Machines Corp.
8 * Author(s): Michael A. Halcrow <mhalcrow@us.ibm.com>

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

39 rc = generic_file_read_iter(iocb, to);
40 if (rc >= 0) {
41 path = ecryptfs_dentry_to_lower_path(file->f_path.dentry);
42 touch_atime(path);
43 }
44 return rc;
45}
46
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * eCryptfs: Linux filesystem encryption layer
4 *
5 * Copyright (C) 1997-2004 Erez Zadok
6 * Copyright (C) 2001-2004 Stony Brook University
7 * Copyright (C) 2004-2007 International Business Machines Corp.
8 * Author(s): Michael A. Halcrow <mhalcrow@us.ibm.com>

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

39 rc = generic_file_read_iter(iocb, to);
40 if (rc >= 0) {
41 path = ecryptfs_dentry_to_lower_path(file->f_path.dentry);
42 touch_atime(path);
43 }
44 return rc;
45}
46
47/*
48 * ecryptfs_splice_read_update_atime
49 *
50 * generic_file_splice_read updates the atime of upper layer inode. But, it
51 * doesn't give us a chance to update the atime of the lower layer inode. This
52 * function is a wrapper to generic_file_read. It updates the atime of the
53 * lower level inode if generic_file_read returns without any errors. This is
54 * to be used only for file reads. The function to be used for directory reads
55 * is ecryptfs_read.
56 */
57static ssize_t ecryptfs_splice_read_update_atime(struct file *in, loff_t *ppos,
58 struct pipe_inode_info *pipe,
59 size_t len, unsigned int flags)
60{
61 ssize_t rc;
62 const struct path *path;
63
64 rc = generic_file_splice_read(in, ppos, pipe, len, flags);
65 if (rc >= 0) {
66 path = ecryptfs_dentry_to_lower_path(in->f_path.dentry);
67 touch_atime(path);
68 }
69 return rc;
70}
71
47struct ecryptfs_getdents_callback {
48 struct dir_context ctx;
49 struct dir_context *caller;
50 struct super_block *sb;
51 int filldir_called;
52 int entries_written;
53};
54

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

409 .compat_ioctl = ecryptfs_compat_ioctl,
410#endif
411 .mmap = ecryptfs_mmap,
412 .open = ecryptfs_open,
413 .flush = ecryptfs_flush,
414 .release = ecryptfs_release,
415 .fsync = ecryptfs_fsync,
416 .fasync = ecryptfs_fasync,
72struct ecryptfs_getdents_callback {
73 struct dir_context ctx;
74 struct dir_context *caller;
75 struct super_block *sb;
76 int filldir_called;
77 int entries_written;
78};
79

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

434 .compat_ioctl = ecryptfs_compat_ioctl,
435#endif
436 .mmap = ecryptfs_mmap,
437 .open = ecryptfs_open,
438 .flush = ecryptfs_flush,
439 .release = ecryptfs_release,
440 .fsync = ecryptfs_fsync,
441 .fasync = ecryptfs_fasync,
417 .splice_read = generic_file_splice_read,
442 .splice_read = ecryptfs_splice_read_update_atime,
418};
443};