Re: [patch] Move CRC computation to separate function

From: Artem Bityutskiy
Date: Wed Feb 29 2012 - 11:08:41 EST


On Mon, 2012-02-20 at 21:15 +0100, Joel Reardon wrote:
> This patch moves the computation of CRCs for data nodes from
> within ubifs_prepare_node to a separate function ubifs_set_datanode_crc,
> which takes a data node, and computes and sets the CRC. This is to avoid
> duplication of the CRC computation code in other places where it may be
> needed.
>
> Signed-off-by: Joel Reardon <reardonj@xxxxxxxxxxx>
> diff -uprN -X linux-3.2.1-vanilla/Documentation/dontdiff
> linux-3.2.1-vanilla/fs/ubifs/io.c linux-3.2.1-ubifsec/fs/ubifs/io.c
> --- linux-3.2.1-vanilla/fs/ubifs/io.c 2012-01-12 20:42:45.000000000
> +0100
> +++ linux-3.2.1-ubifsec/fs/ubifs/io.c 2012-02-20 20:17:48.796684293
> +0100
> @@ -367,6 +367,18 @@ static unsigned long long next_sqnum(str
> }

This patch is line-wrapped and cannot be applied. Would you please send
a non-wrapped version. You may experiment by sending to yourself, then
saving, and then applying using "git am".

>
> /**
> + * ubifs_set_datanode_crc - writes the crc for a data node to the common
> + * header.
> + * @node: the data node
> + */
> +void ubifs_set_datanode_crc(void *node)
> +{
> + struct ubifs_ch *ch = (struct ubifs_ch *) node;
> + int len = le32_to_cpu(ch->len);
> + ch->crc = cpu_to_le32(crc32(UBIFS_CRC32_INIT, node + 8, len - 8));
> +}

This changes is not needed unless there is other code which needs this
function. So once I get a non-wrapped patch I can create a branch for
you in the UBIFS tree and collect your patches. Once they are ready,
they can be merged.

--
Best Regards,
Artem Bityutskiy

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