Lines Matching +full:lower +full:- +full:case
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright (C) 1997-2004 Erez Zadok
6 * Copyright (C) 2001-2004 Stony Brook University
7 * Copyright (C) 2004-2007 International Business Machines Corp.
26 * doesn't give us a chance to update the atime of the lower layer
28 * updates the atime of the lower level inode if generic_file_read
37 struct file *file = iocb->ki_filp; in ecryptfs_read_update_atime()
41 path = ecryptfs_dentry_to_lower_path(file->f_path.dentry); in ecryptfs_read_update_atime()
66 buf->filldir_called++; in ecryptfs_filldir()
68 buf->sb, lower_name, in ecryptfs_filldir()
71 if (rc != -EINVAL) { in ecryptfs_filldir()
78 /* Mask -EINVAL errors as these are most likely due a plaintext in ecryptfs_filldir()
79 * filename present in the lower filesystem despite filename in ecryptfs_filldir()
87 buf->caller->pos = buf->ctx.pos; in ecryptfs_filldir()
88 rc = !dir_emit(buf->caller, name, name_size, ino, d_type); in ecryptfs_filldir()
91 buf->entries_written++; in ecryptfs_filldir()
109 .sb = inode->i_sb, in ecryptfs_readdir()
113 ctx->pos = buf.ctx.pos; in ecryptfs_readdir()
134 crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; in read_or_initialize_metadata()
136 inode->i_sb)->mount_crypt_stat; in read_or_initialize_metadata()
137 mutex_lock(&crypt_stat->cs_mutex); in read_or_initialize_metadata()
139 if (crypt_stat->flags & ECRYPTFS_POLICY_APPLIED && in read_or_initialize_metadata()
140 crypt_stat->flags & ECRYPTFS_KEY_VALID) { in read_or_initialize_metadata()
149 if (mount_crypt_stat->flags & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED) { in read_or_initialize_metadata()
150 crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED in read_or_initialize_metadata()
156 if (!(mount_crypt_stat->flags & ECRYPTFS_XATTR_METADATA_ENABLED) && in read_or_initialize_metadata()
163 rc = -EIO; in read_or_initialize_metadata()
165 mutex_unlock(&crypt_stat->cs_mutex); in read_or_initialize_metadata()
177 if (!lower_file->f_op->mmap) in ecryptfs_mmap()
178 return -ENODEV; in ecryptfs_mmap()
189 * Returns zero on success; non-zero otherwise
195 struct dentry *ecryptfs_dentry = file->f_path.dentry; in ecryptfs_open()
206 rc = -ENOMEM; in ecryptfs_open()
209 crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; in ecryptfs_open()
210 mutex_lock(&crypt_stat->cs_mutex); in ecryptfs_open()
211 if (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED)) { in ecryptfs_open()
214 crypt_stat->flags |= (ECRYPTFS_POLICY_APPLIED in ecryptfs_open()
217 mutex_unlock(&crypt_stat->cs_mutex); in ecryptfs_open()
221 "the lower file for the dentry with name " in ecryptfs_open()
226 if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE) in ecryptfs_open()
227 == O_RDONLY && (file->f_flags & O_ACCMODE) != O_RDONLY) { in ecryptfs_open()
228 rc = -EPERM; in ecryptfs_open()
229 printk(KERN_WARNING "%s: Lower file is RO; eCryptfs " in ecryptfs_open()
234 file, ecryptfs_inode_to_private(inode)->lower_file); in ecryptfs_open()
239 "[0x%.16lx] size: [0x%.16llx]\n", inode, inode->i_ino, in ecryptfs_open()
258 * Returns zero on success; non-zero otherwise
262 struct dentry *ecryptfs_dentry = file->f_path.dentry; in ecryptfs_dir_open()
274 return -ENOMEM; in ecryptfs_dir_open()
277 file->f_flags, current_cred()); in ecryptfs_dir_open()
280 "the lower file for the dentry with name " in ecryptfs_dir_open()
294 if (lower_file->f_op->flush) { in ecryptfs_flush()
295 filemap_write_and_wait(file->f_mapping); in ecryptfs_flush()
296 return lower_file->f_op->flush(lower_file, td); in ecryptfs_flush()
341 if (lower_file->f_op->fasync) in ecryptfs_fasync()
342 rc = lower_file->f_op->fasync(fd, lower_file, flag); in ecryptfs_fasync()
350 long rc = -ENOTTY; in ecryptfs_unlocked_ioctl()
352 if (!lower_file->f_op->unlocked_ioctl) in ecryptfs_unlocked_ioctl()
356 case FITRIM: in ecryptfs_unlocked_ioctl()
357 case FS_IOC_GETFLAGS: in ecryptfs_unlocked_ioctl()
358 case FS_IOC_SETFLAGS: in ecryptfs_unlocked_ioctl()
359 case FS_IOC_GETVERSION: in ecryptfs_unlocked_ioctl()
360 case FS_IOC_SETVERSION: in ecryptfs_unlocked_ioctl()
361 rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg); in ecryptfs_unlocked_ioctl()
375 long rc = -ENOIOCTLCMD; in ecryptfs_compat_ioctl()
377 if (!lower_file->f_op->compat_ioctl) in ecryptfs_compat_ioctl()
381 case FITRIM: in ecryptfs_compat_ioctl()
382 case FS_IOC32_GETFLAGS: in ecryptfs_compat_ioctl()
383 case FS_IOC32_SETFLAGS: in ecryptfs_compat_ioctl()
384 case FS_IOC32_GETVERSION: in ecryptfs_compat_ioctl()
385 case FS_IOC32_SETVERSION: in ecryptfs_compat_ioctl()
386 rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg); in ecryptfs_compat_ioctl()