inode.c (6666ea558b1f4134291c15ac59366f69c2d1f321) | inode.c (e81f3340bba2bdcdf021aff511830e718e6e2112) |
---|---|
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 <mahalcro@us.ibm.com> 8 * Michael C. Thompsion <mcthomps@us.ibm.com> --- 749 unchanged lines hidden (view full) --- 758 * this triggers code that will fill in 0's throughout 759 * the intermediate portion of the previous end of the 760 * file and the new and of the file */ 761 rc = ecryptfs_write(inode, zero, 762 (ia->ia_size - 1), 1); 763 } else { /* ia->ia_size < i_size_read(inode) */ 764 /* We're chopping off all the pages down to the page 765 * in which ia->ia_size is located. Fill in the end of | 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 <mahalcro@us.ibm.com> 8 * Michael C. Thompsion <mcthomps@us.ibm.com> --- 749 unchanged lines hidden (view full) --- 758 * this triggers code that will fill in 0's throughout 759 * the intermediate portion of the previous end of the 760 * file and the new and of the file */ 761 rc = ecryptfs_write(inode, zero, 762 (ia->ia_size - 1), 1); 763 } else { /* ia->ia_size < i_size_read(inode) */ 764 /* We're chopping off all the pages down to the page 765 * in which ia->ia_size is located. Fill in the end of |
766 * that page from (ia->ia_size & ~PAGE_MASK) to 767 * PAGE_SIZE with zeros. */ 768 size_t num_zeros = (PAGE_SIZE 769 - (ia->ia_size & ~PAGE_MASK)); | 766 * that page from (ia->ia_size & ~PAGE_CACHE_MASK) to 767 * PAGE_CACHE_SIZE with zeros. */ 768 size_t num_zeros = (PAGE_CACHE_SIZE 769 - (ia->ia_size & ~PAGE_CACHE_MASK)); |
770 771 if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) { 772 truncate_setsize(inode, ia->ia_size); 773 lower_ia->ia_size = ia->ia_size; 774 lower_ia->ia_valid |= ATTR_SIZE; 775 goto out; 776 } 777 if (num_zeros) { --- 115 unchanged lines hidden (view full) --- 893 int rc = 0; 894 struct dentry *lower_dentry; 895 struct iattr lower_ia; 896 struct inode *inode; 897 struct inode *lower_inode; 898 struct ecryptfs_crypt_stat *crypt_stat; 899 900 crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat; | 770 771 if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) { 772 truncate_setsize(inode, ia->ia_size); 773 lower_ia->ia_size = ia->ia_size; 774 lower_ia->ia_valid |= ATTR_SIZE; 775 goto out; 776 } 777 if (num_zeros) { --- 115 unchanged lines hidden (view full) --- 893 int rc = 0; 894 struct dentry *lower_dentry; 895 struct iattr lower_ia; 896 struct inode *inode; 897 struct inode *lower_inode; 898 struct ecryptfs_crypt_stat *crypt_stat; 899 900 crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat; |
901 if (!(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED)) 902 ecryptfs_init_crypt_stat(crypt_stat); | 901 if (!(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED)) { 902 rc = ecryptfs_init_crypt_stat(crypt_stat); 903 if (rc) 904 return rc; 905 } |
903 inode = d_inode(dentry); 904 lower_inode = ecryptfs_inode_to_lower(inode); 905 lower_dentry = ecryptfs_dentry_to_lower(dentry); 906 mutex_lock(&crypt_stat->cs_mutex); 907 if (d_is_dir(dentry)) 908 crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED); 909 else if (d_is_reg(dentry) 910 && (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED) --- 224 unchanged lines hidden --- | 906 inode = d_inode(dentry); 907 lower_inode = ecryptfs_inode_to_lower(inode); 908 lower_dentry = ecryptfs_dentry_to_lower(dentry); 909 mutex_lock(&crypt_stat->cs_mutex); 910 if (d_is_dir(dentry)) 911 crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED); 912 else if (d_is_reg(dentry) 913 && (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED) --- 224 unchanged lines hidden --- |