Re: [PATCH v3] UBIFS: compute KSA size and store in superblock

From: Artem Bityutskiy
Date: Wed Jun 06 2012 - 10:26:27 EST


Hi Joel,

still a couple of small requests.

On Wed, 2012-06-06 at 12:03 +0200, Joel Reardon wrote:
> + if (c->use_ubifsec && c->ksa_lebs <
> + ((c->leb_cnt * UBIFS_CRYPTO_KEYSIZE) >> UBIFS_BLOCK_SHIFT) +

Please, do something like this:

min_leb_cnt = (c->leb_cnt * UBIFS_CRYPTO_KEYSIZE) >> UBIFS_BLOCK_SHIFT;
if (c->use_ubifsec && c->ksa_lebs < min_leb_cnt)
bah;
min_leb_cnt += UBIFS_KSA_ADD_LEBS;
if ()
bah;

That would be more readable.

> struct ubifs_sb_node {
> struct ubifs_ch ch;
> @@ -649,7 +652,9 @@ struct ubifs_sb_node {
> __le32 time_gran;
> __u8 uuid[16];
> __le32 ro_compat_version;
> - __u8 padding2[3968];
> + __le32 ksa_lebs;
> + __u8 use_ubifsec;
> + __u8 padding2[3963];
> } __packed;

I've just noticed that we have the 'flags' field ane a set of flags like
"UBIFS_FLG_SPACE_FIXUP". For UBIFSEC, could you please add
"UBIFS_FLG_UBFSEC = 0x8" or you name it. This would be more consistent
way.

--
Best Regards,
Artem Bityutskiy

Attachment: signature.asc
Description: This is a digitally signed message part