Re: [PATCH 2/7] udf: create common function for tag checksumming

From: Christoph Hellwig
Date: Mon Jan 07 2008 - 07:29:52 EST


> --- a/fs/udf/udfdecl.h
> +++ b/fs/udf/udfdecl.h
> @@ -36,6 +36,18 @@
>
> #define udf_get_lb_pblock(sb,loc,offset) udf_get_pblock((sb), (loc).logicalBlockNum, (loc).partitionReferenceNum, (offset))
>
> +/* computes tag checksum */
> +static inline uint8_t udf_tag_checksum(const tag *t)
> +{
> + uint8_t *data = (uint8_t *)t;
> + uint8_t checksum = 0;
> + int i;
> + for (i = 0; i < sizeof(tag); ++i)
> + if (i != 4) /* that's the position of checksum */
> + checksum += data[i];
> + return checksum;
> +}

This function is large enough that it should be out of line in a .c
file. Also I'd prefer using the Linux native types ala:

/* computes tag checksum */
static u8 udf_tag_checksum(const tag *t)
{
u8 *data = (u8 *)t;
u8 checksum = 0;
int i;

for (i = 0; i < sizeof(tag); i++) {
if (i != 4) /* position of the checksum */
checksum += data[i];
}

return checksum;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/