[PATCH] eCryptfs: Improve statfs reporting

Tim Gardner tim.gardner at canonical.com
Fri Dec 23 17:06:09 UTC 2011


On 12/23/2011 08:49 AM, Tim Gardner wrote:

<snip>

>> + /* Return an exact amount for the common cases */
>> + if (lower_namelen == NAME_MAX
>> + && (cipher_blocksize == 8 || cipher_blocksize == 16)) {
>> + (*namelen) = ENC_NAME_MAX_BLOCKLEN_8_OR_16;
>> + return 0;
>> + }
>
> How different are the answers for the common case vs the uncommon cases?
> I kind of object to having 2 code paths for this, one of which is
> unlikely to get exercised very often and has largely untested complexity.
>
>> +
>> + /* Return a safe estimate for the uncommon cases */
>> + (*namelen) = lower_namelen;
>> + (*namelen) -= ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE;
>> + /* Since this is the max decoded size, subtract 1 "decoded block"
>> len */
>> + (*namelen) = ecryptfs_max_decoded_size(*namelen) - 3;
>> + (*namelen) -= ECRYPTFS_TAG_70_MAX_METADATA_SIZE;
>> + (*namelen) -= ECRYPTFS_FILENAME_MIN_RANDOM_PREPEND_BYTES;
>> + /* Worst case is that the filename is padded nearly a full block
>> size */
>> + (*namelen) -= cipher_blocksize - 1;
>> +

The difference is 143 vs 127 when mounted on ext4.

-- 
Tim Gardner tim.gardner at canonical.com




More information about the kernel-team mailing list