aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/inode.c
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2007-02-12 03:53:49 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:37 -0500
commite2bd99ec5c0e20ed6aeb079fa8f975c2dcd78a2c (patch)
tree78892d49cf55fa4cf22ce9b8b226c63bac8b227c /fs/ecryptfs/inode.c
parent9d8b8ce5561890464c54645cdea4d6b157159fec (diff)
[PATCH] eCryptfs: open-code flag checking and manipulation
Open-code flag checking and manipulation. Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Trevor Highland <tshighla@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs/inode.c')
-rw-r--r--fs/ecryptfs/inode.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 7d3391712027..91357183398d 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -161,9 +161,8 @@ static int grow_file(struct dentry *ecryptfs_dentry, struct file *lower_file,
161 ecryptfs_set_file_lower(&fake_file, lower_file); 161 ecryptfs_set_file_lower(&fake_file, lower_file);
162 rc = ecryptfs_fill_zeros(&fake_file, 1); 162 rc = ecryptfs_fill_zeros(&fake_file, 1);
163 if (rc) { 163 if (rc) {
164 ECRYPTFS_SET_FLAG( 164 ecryptfs_inode_to_private(inode)->crypt_stat.flags |=
165 ecryptfs_inode_to_private(inode)->crypt_stat.flags, 165 ECRYPTFS_SECURITY_WARNING;
166 ECRYPTFS_SECURITY_WARNING);
167 ecryptfs_printk(KERN_WARNING, "Error attempting to fill zeros " 166 ecryptfs_printk(KERN_WARNING, "Error attempting to fill zeros "
168 "in file; rc = [%d]\n", rc); 167 "in file; rc = [%d]\n", rc);
169 goto out; 168 goto out;
@@ -172,8 +171,7 @@ static int grow_file(struct dentry *ecryptfs_dentry, struct file *lower_file,
172 ecryptfs_write_inode_size_to_metadata(lower_file, lower_inode, inode, 171 ecryptfs_write_inode_size_to_metadata(lower_file, lower_inode, inode,
173 ecryptfs_dentry, 172 ecryptfs_dentry,
174 ECRYPTFS_LOWER_I_MUTEX_NOT_HELD); 173 ECRYPTFS_LOWER_I_MUTEX_NOT_HELD);
175 ECRYPTFS_SET_FLAG(ecryptfs_inode_to_private(inode)->crypt_stat.flags, 174 ecryptfs_inode_to_private(inode)->crypt_stat.flags |= ECRYPTFS_NEW_FILE;
176 ECRYPTFS_NEW_FILE);
177out: 175out:
178 return rc; 176 return rc;
179} 177}
@@ -216,10 +214,10 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry)
216 lower_inode = lower_dentry->d_inode; 214 lower_inode = lower_dentry->d_inode;
217 if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) { 215 if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
218 ecryptfs_printk(KERN_DEBUG, "This is a directory\n"); 216 ecryptfs_printk(KERN_DEBUG, "This is a directory\n");
219 ECRYPTFS_CLEAR_FLAG(crypt_stat->flags, ECRYPTFS_ENCRYPTED); 217 crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
220 goto out_fput; 218 goto out_fput;
221 } 219 }
222 ECRYPTFS_SET_FLAG(crypt_stat->flags, ECRYPTFS_NEW_FILE); 220 crypt_stat->flags |= ECRYPTFS_NEW_FILE;
223 ecryptfs_printk(KERN_DEBUG, "Initializing crypto context\n"); 221 ecryptfs_printk(KERN_DEBUG, "Initializing crypto context\n");
224 rc = ecryptfs_new_file_context(ecryptfs_dentry); 222 rc = ecryptfs_new_file_context(ecryptfs_dentry);
225 if (rc) { 223 if (rc) {
@@ -373,7 +371,7 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
373 goto out_dput; 371 goto out_dput;
374 } 372 }
375 crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; 373 crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat;
376 if (!ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_POLICY_APPLIED)) 374 if (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED))
377 ecryptfs_set_default_sizes(crypt_stat); 375 ecryptfs_set_default_sizes(crypt_stat);
378 rc = ecryptfs_read_and_validate_header_region(page_virt, lower_dentry, 376 rc = ecryptfs_read_and_validate_header_region(page_virt, lower_dentry,
379 nd->mnt); 377 nd->mnt);