mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 10:33:27 +00:00
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>
This commit is contained in:
parent
157f107135
commit
fa3ef1cb4e
4 changed files with 15 additions and 20 deletions
|
@ -834,14 +834,13 @@ void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat)
|
|||
set_extent_mask_and_shift(crypt_stat);
|
||||
crypt_stat->iv_bytes = ECRYPTFS_DEFAULT_IV_BYTES;
|
||||
if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR)
|
||||
crypt_stat->num_header_bytes_at_front =
|
||||
ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE;
|
||||
crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE;
|
||||
else {
|
||||
if (PAGE_CACHE_SIZE <= ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE)
|
||||
crypt_stat->num_header_bytes_at_front =
|
||||
crypt_stat->metadata_size =
|
||||
ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE;
|
||||
else
|
||||
crypt_stat->num_header_bytes_at_front = PAGE_CACHE_SIZE;
|
||||
crypt_stat->metadata_size = PAGE_CACHE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1238,8 +1237,7 @@ ecryptfs_write_header_metadata(char *virt,
|
|||
|
||||
header_extent_size = (u32)crypt_stat->extent_size;
|
||||
num_header_extents_at_front =
|
||||
(u16)(crypt_stat->num_header_bytes_at_front
|
||||
/ crypt_stat->extent_size);
|
||||
(u16)(crypt_stat->metadata_size / crypt_stat->extent_size);
|
||||
put_unaligned_be32(header_extent_size, virt);
|
||||
virt += 4;
|
||||
put_unaligned_be16(num_header_extents_at_front, virt);
|
||||
|
@ -1382,7 +1380,7 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry)
|
|||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
virt_len = crypt_stat->num_header_bytes_at_front;
|
||||
virt_len = crypt_stat->metadata_size;
|
||||
order = get_order(virt_len);
|
||||
/* Released in this function */
|
||||
virt = (char *)ecryptfs_get_zeroed_pages(GFP_KERNEL, order);
|
||||
|
@ -1428,16 +1426,15 @@ static int parse_header_metadata(struct ecryptfs_crypt_stat *crypt_stat,
|
|||
header_extent_size = get_unaligned_be32(virt);
|
||||
virt += sizeof(__be32);
|
||||
num_header_extents_at_front = get_unaligned_be16(virt);
|
||||
crypt_stat->num_header_bytes_at_front =
|
||||
(((size_t)num_header_extents_at_front
|
||||
* (size_t)header_extent_size));
|
||||
crypt_stat->metadata_size = (((size_t)num_header_extents_at_front
|
||||
* (size_t)header_extent_size));
|
||||
(*bytes_read) = (sizeof(__be32) + sizeof(__be16));
|
||||
if ((validate_header_size == ECRYPTFS_VALIDATE_HEADER_SIZE)
|
||||
&& (crypt_stat->num_header_bytes_at_front
|
||||
&& (crypt_stat->metadata_size
|
||||
< ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE)) {
|
||||
rc = -EINVAL;
|
||||
printk(KERN_WARNING "Invalid header size: [%zd]\n",
|
||||
crypt_stat->num_header_bytes_at_front);
|
||||
crypt_stat->metadata_size);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
@ -1452,8 +1449,7 @@ static int parse_header_metadata(struct ecryptfs_crypt_stat *crypt_stat,
|
|||
*/
|
||||
static void set_default_header_data(struct ecryptfs_crypt_stat *crypt_stat)
|
||||
{
|
||||
crypt_stat->num_header_bytes_at_front =
|
||||
ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE;
|
||||
crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -273,7 +273,7 @@ struct ecryptfs_crypt_stat {
|
|||
u32 flags;
|
||||
unsigned int file_version;
|
||||
size_t iv_bytes;
|
||||
size_t num_header_bytes_at_front;
|
||||
size_t metadata_size;
|
||||
size_t extent_size; /* Data extent size; default is 4096 */
|
||||
size_t key_size;
|
||||
size_t extent_shift;
|
||||
|
@ -469,7 +469,7 @@ ecryptfs_lower_header_size(struct ecryptfs_crypt_stat *crypt_stat)
|
|||
{
|
||||
if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR)
|
||||
return 0;
|
||||
return crypt_stat->num_header_bytes_at_front;
|
||||
return crypt_stat->metadata_size;
|
||||
}
|
||||
|
||||
static inline struct ecryptfs_file_info *
|
||||
|
|
|
@ -335,7 +335,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry,
|
|||
ecryptfs_dentry->d_sb)->mount_crypt_stat;
|
||||
if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) {
|
||||
if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR)
|
||||
file_size = (crypt_stat->num_header_bytes_at_front
|
||||
file_size = (crypt_stat->metadata_size
|
||||
+ i_size_read(lower_dentry->d_inode));
|
||||
else
|
||||
file_size = i_size_read(lower_dentry->d_inode);
|
||||
|
|
|
@ -122,8 +122,7 @@ ecryptfs_copy_up_encrypted_with_header(struct page *page,
|
|||
* num_extents_per_page)
|
||||
+ extent_num_in_page);
|
||||
size_t num_header_extents_at_front =
|
||||
(crypt_stat->num_header_bytes_at_front
|
||||
/ crypt_stat->extent_size);
|
||||
(crypt_stat->metadata_size / crypt_stat->extent_size);
|
||||
|
||||
if (view_extent_num < num_header_extents_at_front) {
|
||||
/* This is a header extent */
|
||||
|
@ -152,7 +151,7 @@ ecryptfs_copy_up_encrypted_with_header(struct page *page,
|
|||
/* This is an encrypted data extent */
|
||||
loff_t lower_offset =
|
||||
((view_extent_num * crypt_stat->extent_size)
|
||||
- crypt_stat->num_header_bytes_at_front);
|
||||
- crypt_stat->metadata_size);
|
||||
|
||||
rc = ecryptfs_read_lower_page_segment(
|
||||
page, (lower_offset >> PAGE_CACHE_SHIFT),
|
||||
|
|
Loading…
Reference in a new issue