file.c (e3ccaa9761200952cc269b1f4b7d7bb77a5e071b) file.c (821f7494a77627fb1ab539591c57b22cdca702d6)
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>

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

133 goto out;
134 if (rc >= 0)
135 fsstack_copy_attr_atime(inode,
136 lower_file->f_path.dentry->d_inode);
137out:
138 return rc;
139}
140
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>

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

133 goto out;
134 if (rc >= 0)
135 fsstack_copy_attr_atime(inode,
136 lower_file->f_path.dentry->d_inode);
137out:
138 return rc;
139}
140
141static void ecryptfs_vma_close(struct vm_area_struct *vma)
142{
143 filemap_write_and_wait(vma->vm_file->f_mapping);
144}
145
146static const struct vm_operations_struct ecryptfs_file_vm_ops = {
147 .close = ecryptfs_vma_close,
148 .fault = filemap_fault,
149};
150
151static int ecryptfs_file_mmap(struct file *file, struct vm_area_struct *vma)
152{
153 int rc;
154
155 rc = generic_file_mmap(file, vma);
156 if (!rc)
157 vma->vm_ops = &ecryptfs_file_vm_ops;
158
159 return rc;
160}
161
162struct kmem_cache *ecryptfs_file_info_cache;
163
164static int read_or_initialize_metadata(struct dentry *dentry)
165{
166 struct inode *inode = dentry->d_inode;
167 struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
168 struct ecryptfs_crypt_stat *crypt_stat;
169 int rc;

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

306 kmem_cache_free(ecryptfs_file_info_cache,
307 ecryptfs_file_to_private(file));
308 return 0;
309}
310
311static int
312ecryptfs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
313{
141struct kmem_cache *ecryptfs_file_info_cache;
142
143static int read_or_initialize_metadata(struct dentry *dentry)
144{
145 struct inode *inode = dentry->d_inode;
146 struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
147 struct ecryptfs_crypt_stat *crypt_stat;
148 int rc;

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

285 kmem_cache_free(ecryptfs_file_info_cache,
286 ecryptfs_file_to_private(file));
287 return 0;
288}
289
290static int
291ecryptfs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
292{
314 int rc = 0;
315
316 rc = generic_file_fsync(file, start, end, datasync);
317 if (rc)
318 goto out;
319 rc = vfs_fsync_range(ecryptfs_file_to_lower(file), start, end,
320 datasync);
321out:
322 return rc;
293 return vfs_fsync(ecryptfs_file_to_lower(file), datasync);
323}
324
325static int ecryptfs_fasync(int fd, struct file *file, int flag)
326{
327 int rc = 0;
328 struct file *lower_file = NULL;
329
330 lower_file = ecryptfs_file_to_lower(file);

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

383 .aio_read = ecryptfs_read_update_atime,
384 .write = do_sync_write,
385 .aio_write = generic_file_aio_write,
386 .readdir = ecryptfs_readdir,
387 .unlocked_ioctl = ecryptfs_unlocked_ioctl,
388#ifdef CONFIG_COMPAT
389 .compat_ioctl = ecryptfs_compat_ioctl,
390#endif
294}
295
296static int ecryptfs_fasync(int fd, struct file *file, int flag)
297{
298 int rc = 0;
299 struct file *lower_file = NULL;
300
301 lower_file = ecryptfs_file_to_lower(file);

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

354 .aio_read = ecryptfs_read_update_atime,
355 .write = do_sync_write,
356 .aio_write = generic_file_aio_write,
357 .readdir = ecryptfs_readdir,
358 .unlocked_ioctl = ecryptfs_unlocked_ioctl,
359#ifdef CONFIG_COMPAT
360 .compat_ioctl = ecryptfs_compat_ioctl,
361#endif
391 .mmap = ecryptfs_file_mmap,
362 .mmap = generic_file_mmap,
392 .open = ecryptfs_open,
393 .flush = ecryptfs_flush,
394 .release = ecryptfs_release,
395 .fsync = ecryptfs_fsync,
396 .fasync = ecryptfs_fasync,
397 .splice_read = generic_file_splice_read,
398};
363 .open = ecryptfs_open,
364 .flush = ecryptfs_flush,
365 .release = ecryptfs_release,
366 .fsync = ecryptfs_fsync,
367 .fasync = ecryptfs_fasync,
368 .splice_read = generic_file_splice_read,
369};