diff options
author | Tyler Hicks <tyhicks@linux.vnet.ibm.com> | 2011-05-24 05:56:23 -0400 |
---|---|---|
committer | Tyler Hicks <tyhicks@linux.vnet.ibm.com> | 2011-05-29 15:24:24 -0400 |
commit | 778aeb42a708d2a57e491d2cbb5a1e74f61270b9 (patch) | |
tree | 6651d8a2356b9075e6978285cbcfa7aab16e9b7a /fs/ecryptfs/ecryptfs_kernel.h | |
parent | 7a86617e553f47761b10f57de472d7262562b7de (diff) |
eCryptfs: Cleanup and optimize ecryptfs_lookup_interpose()
ecryptfs_lookup_interpose() has turned into spaghetti code over the
years. This is an effort to clean it up.
- Shorten overly descriptive variable names such as ecryptfs_dentry
- Simplify gotos and error paths
- Create helper function for reading plaintext i_size from metadata
It also includes an optimization when reading i_size from the metadata.
A complete page-sized kmem_cache_alloc() was being done to read in 16
bytes of metadata. The buffer for that is now statically declared.
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Diffstat (limited to 'fs/ecryptfs/ecryptfs_kernel.h')
-rw-r--r-- | fs/ecryptfs/ecryptfs_kernel.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 72aa24a4c71e..8297ddaca7c4 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -200,6 +200,8 @@ ecryptfs_get_key_payload_data(struct key *key) | |||
200 | #define MAGIC_ECRYPTFS_MARKER 0x3c81b7f5 | 200 | #define MAGIC_ECRYPTFS_MARKER 0x3c81b7f5 |
201 | #define MAGIC_ECRYPTFS_MARKER_SIZE_BYTES 8 /* 4*2 */ | 201 | #define MAGIC_ECRYPTFS_MARKER_SIZE_BYTES 8 /* 4*2 */ |
202 | #define ECRYPTFS_FILE_SIZE_BYTES (sizeof(u64)) | 202 | #define ECRYPTFS_FILE_SIZE_BYTES (sizeof(u64)) |
203 | #define ECRYPTFS_SIZE_AND_MARKER_BYTES (ECRYPTFS_FILE_SIZE_BYTES \ | ||
204 | + MAGIC_ECRYPTFS_MARKER_SIZE_BYTES) | ||
203 | #define ECRYPTFS_DEFAULT_CIPHER "aes" | 205 | #define ECRYPTFS_DEFAULT_CIPHER "aes" |
204 | #define ECRYPTFS_DEFAULT_KEY_BYTES 16 | 206 | #define ECRYPTFS_DEFAULT_KEY_BYTES 16 |
205 | #define ECRYPTFS_DEFAULT_HASH "md5" | 207 | #define ECRYPTFS_DEFAULT_HASH "md5" |
@@ -659,9 +661,8 @@ int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry); | |||
659 | void ecryptfs_write_crypt_stat_flags(char *page_virt, | 661 | void ecryptfs_write_crypt_stat_flags(char *page_virt, |
660 | struct ecryptfs_crypt_stat *crypt_stat, | 662 | struct ecryptfs_crypt_stat *crypt_stat, |
661 | size_t *written); | 663 | size_t *written); |
662 | int ecryptfs_read_and_validate_header_region(char *data, | 664 | int ecryptfs_read_and_validate_header_region(struct inode *inode); |
663 | struct inode *ecryptfs_inode); | 665 | int ecryptfs_read_and_validate_xattr_region(struct dentry *dentry, |
664 | int ecryptfs_read_and_validate_xattr_region(char *page_virt, | ||
665 | struct inode *inode); | 666 | struct inode *inode); |
666 | u8 ecryptfs_code_for_cipher_string(char *cipher_name, size_t key_bytes); | 667 | u8 ecryptfs_code_for_cipher_string(char *cipher_name, size_t key_bytes); |
667 | int ecryptfs_cipher_code_to_string(char *str, u8 cipher_code); | 668 | int ecryptfs_cipher_code_to_string(char *str, u8 cipher_code); |