diff options
author | Tyler Hicks <tyhicks@linux.vnet.ibm.com> | 2010-02-11 06:09:14 -0500 |
---|---|---|
committer | Tyler Hicks <tyhicks@linux.vnet.ibm.com> | 2010-03-23 13:30:41 -0400 |
commit | fa3ef1cb4e6e9958a9bfaa977c107c515907f102 (patch) | |
tree | f297192533a0c8720534c76c6429e68ae92b94d9 /fs/ecryptfs/crypto.c | |
parent | 157f1071354db1aed885816094888e0e257c9d0a (diff) |
eCryptfs: Rename ecryptfs_crypt_stat.num_header_bytes_at_front
This patch renames the num_header_bytes_at_front variable to
metadata_size since it now contains the max size of the metadata.
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Diffstat (limited to 'fs/ecryptfs/crypto.c')
-rw-r--r-- | fs/ecryptfs/crypto.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index c907f6f49351..391f558eb4d0 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -834,14 +834,13 @@ void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat) | |||
834 | set_extent_mask_and_shift(crypt_stat); | 834 | set_extent_mask_and_shift(crypt_stat); |
835 | crypt_stat->iv_bytes = ECRYPTFS_DEFAULT_IV_BYTES; | 835 | crypt_stat->iv_bytes = ECRYPTFS_DEFAULT_IV_BYTES; |
836 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | 836 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) |
837 | crypt_stat->num_header_bytes_at_front = | 837 | crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; |
838 | ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; | ||
839 | else { | 838 | else { |
840 | if (PAGE_CACHE_SIZE <= ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE) | 839 | if (PAGE_CACHE_SIZE <= ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE) |
841 | crypt_stat->num_header_bytes_at_front = | 840 | crypt_stat->metadata_size = |
842 | ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; | 841 | ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; |
843 | else | 842 | else |
844 | crypt_stat->num_header_bytes_at_front = PAGE_CACHE_SIZE; | 843 | crypt_stat->metadata_size = PAGE_CACHE_SIZE; |
845 | } | 844 | } |
846 | } | 845 | } |
847 | 846 | ||
@@ -1238,8 +1237,7 @@ ecryptfs_write_header_metadata(char *virt, | |||
1238 | 1237 | ||
1239 | header_extent_size = (u32)crypt_stat->extent_size; | 1238 | header_extent_size = (u32)crypt_stat->extent_size; |
1240 | num_header_extents_at_front = | 1239 | num_header_extents_at_front = |
1241 | (u16)(crypt_stat->num_header_bytes_at_front | 1240 | (u16)(crypt_stat->metadata_size / crypt_stat->extent_size); |
1242 | / crypt_stat->extent_size); | ||
1243 | put_unaligned_be32(header_extent_size, virt); | 1241 | put_unaligned_be32(header_extent_size, virt); |
1244 | virt += 4; | 1242 | virt += 4; |
1245 | put_unaligned_be16(num_header_extents_at_front, virt); | 1243 | put_unaligned_be16(num_header_extents_at_front, virt); |
@@ -1382,7 +1380,7 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry) | |||
1382 | rc = -EINVAL; | 1380 | rc = -EINVAL; |
1383 | goto out; | 1381 | goto out; |
1384 | } | 1382 | } |
1385 | virt_len = crypt_stat->num_header_bytes_at_front; | 1383 | virt_len = crypt_stat->metadata_size; |
1386 | order = get_order(virt_len); | 1384 | order = get_order(virt_len); |
1387 | /* Released in this function */ | 1385 | /* Released in this function */ |
1388 | virt = (char *)ecryptfs_get_zeroed_pages(GFP_KERNEL, order); | 1386 | virt = (char *)ecryptfs_get_zeroed_pages(GFP_KERNEL, order); |
@@ -1428,16 +1426,15 @@ static int parse_header_metadata(struct ecryptfs_crypt_stat *crypt_stat, | |||
1428 | header_extent_size = get_unaligned_be32(virt); | 1426 | header_extent_size = get_unaligned_be32(virt); |
1429 | virt += sizeof(__be32); | 1427 | virt += sizeof(__be32); |
1430 | num_header_extents_at_front = get_unaligned_be16(virt); | 1428 | num_header_extents_at_front = get_unaligned_be16(virt); |
1431 | crypt_stat->num_header_bytes_at_front = | 1429 | crypt_stat->metadata_size = (((size_t)num_header_extents_at_front |
1432 | (((size_t)num_header_extents_at_front | 1430 | * (size_t)header_extent_size)); |
1433 | * (size_t)header_extent_size)); | ||
1434 | (*bytes_read) = (sizeof(__be32) + sizeof(__be16)); | 1431 | (*bytes_read) = (sizeof(__be32) + sizeof(__be16)); |
1435 | if ((validate_header_size == ECRYPTFS_VALIDATE_HEADER_SIZE) | 1432 | if ((validate_header_size == ECRYPTFS_VALIDATE_HEADER_SIZE) |
1436 | && (crypt_stat->num_header_bytes_at_front | 1433 | && (crypt_stat->metadata_size |
1437 | < ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE)) { | 1434 | < ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE)) { |
1438 | rc = -EINVAL; | 1435 | rc = -EINVAL; |
1439 | printk(KERN_WARNING "Invalid header size: [%zd]\n", | 1436 | printk(KERN_WARNING "Invalid header size: [%zd]\n", |
1440 | crypt_stat->num_header_bytes_at_front); | 1437 | crypt_stat->metadata_size); |
1441 | } | 1438 | } |
1442 | return rc; | 1439 | return rc; |
1443 | } | 1440 | } |
@@ -1452,8 +1449,7 @@ static int parse_header_metadata(struct ecryptfs_crypt_stat *crypt_stat, | |||
1452 | */ | 1449 | */ |
1453 | static void set_default_header_data(struct ecryptfs_crypt_stat *crypt_stat) | 1450 | static void set_default_header_data(struct ecryptfs_crypt_stat *crypt_stat) |
1454 | { | 1451 | { |
1455 | crypt_stat->num_header_bytes_at_front = | 1452 | crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; |
1456 | ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; | ||
1457 | } | 1453 | } |
1458 | 1454 | ||
1459 | /** | 1455 | /** |