Skip to content

Commit da0102a

Browse files
Michael HalcrowLinus Torvalds
authored andcommitted
eCryptfs: read_write.c routines
Add a set of functions through which all I/O to lower files is consolidated. This patch adds a new inode_info reference to a persistent lower file for each eCryptfs inode; another patch later in this series will set that up. This persistent lower file is what the read_write.c functions use to call vfs_read() and vfs_write() on the lower filesystem, so even when reads and writes come in through aops->readpage and aops->writepage, we can satisfy them without resorting to direct access to the lower inode's address space. Several function declarations are going to be changing with this patchset. For now, in order to keep from breaking the build, I am putting dummy parameters in for those functions. Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent cf81f89 commit da0102a

4 files changed

Lines changed: 379 additions & 2 deletions

File tree

‎fs/ecryptfs/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
obj-$(CONFIG_ECRYPT_FS) += ecryptfs.o
66

7-
ecryptfs-objs := dentry.o file.o inode.o main.o super.o mmap.o crypto.o keystore.o messaging.o netlink.o debug.o
7+
ecryptfs-objs := dentry.o file.o inode.o main.o super.o mmap.o read_write.o crypto.o keystore.o messaging.o netlink.o debug.o

‎fs/ecryptfs/ecryptfs_kernel.h‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ struct ecryptfs_crypt_stat {
260260
struct ecryptfs_inode_info {
261261
struct inode vfs_inode;
262262
struct inode *wii_inode;
263+
struct file *lower_file;
264+
struct mutex lower_file_mutex;
263265
struct ecryptfs_crypt_stat crypt_stat;
264266
};
265267

@@ -653,5 +655,21 @@ int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key,
653655
char *sig);
654656
int ecryptfs_write_zeros(struct file *file, pgoff_t index, int start,
655657
int num_zeros);
658+
int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data,
659+
loff_t offset, size_t size);
660+
int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode,
661+
struct page *page_for_lower,
662+
size_t offset_in_page, size_t size);
663+
int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset,
664+
size_t size);
665+
int ecryptfs_read_lower(char *data, loff_t offset, size_t size,
666+
struct inode *ecryptfs_inode);
667+
int ecryptfs_read_lower_page_segment(struct page *page_for_ecryptfs,
668+
pgoff_t page_index,
669+
size_t offset_in_page, size_t size,
670+
struct inode *ecryptfs_inode);
671+
int ecryptfs_read(char *data, loff_t offset, size_t size,
672+
struct file *ecryptfs_file);
673+
struct page *ecryptfs_get1page(struct file *file, loff_t index);
656674

657675
#endif /* #ifndef ECRYPTFS_KERNEL_H */

‎fs/ecryptfs/mmap.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct kmem_cache *ecryptfs_lower_page_cache;
4444
* Returns unlocked and up-to-date page (if ok), with increased
4545
* refcnt.
4646
*/
47-
static struct page *ecryptfs_get1page(struct file *file, int index)
47+
struct page *ecryptfs_get1page(struct file *file, loff_t index)
4848
{
4949
struct dentry *dentry;
5050
struct inode *inode;

0 commit comments

Comments
 (0)