[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080107122933.GD3710@infradead.org>
Date: Mon, 7 Jan 2008 12:29:34 +0000
From: Christoph Hellwig <hch@...radead.org>
To: marcin.slusarz@...il.com
Cc: LKML <linux-kernel@...r.kernel.org>,
Ben Fennema <bfennema@...con.csc.calpoly.edu>,
Jan Kara <jack@...e.cz>, Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH 2/7] udf: create common function for tag checksumming
> --- 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists