All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: marcin.slusarz@gmail.com
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ben Fennema <bfennema@falcon.csc.calpoly.edu>,
	Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH 2/7] udf: create common function for tag checksumming
Date: Mon, 7 Jan 2008 12:29:34 +0000	[thread overview]
Message-ID: <20080107122933.GD3710@infradead.org> (raw)
In-Reply-To: <1199582513-7915-2-git-send-email-marcin.slusarz@gmail.com>

> --- 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;
}

  reply	other threads:[~2008-01-07 12:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-06  1:21 [PATCH 0/7] udf: more cleanups marcin.slusarz
2008-01-06  1:21 ` [PATCH 2/7] udf: create common function for tag checksumming marcin.slusarz
2008-01-07 12:29   ` Christoph Hellwig [this message]
2008-01-06  1:21 ` [PATCH 3/7] udf: create common function for changing free space counter marcin.slusarz
2008-01-07 12:41   ` Christoph Hellwig
2008-01-06  1:21 ` [PATCH 4/7] udf: replace loops coded with goto to real loops marcin.slusarz
2008-01-07 14:48   ` Jan Kara
2008-01-07 21:10     ` Marcin Slusarz
2008-01-08 10:17       ` Jan Kara
2008-01-08 18:29         ` Marcin Slusarz
2008-01-06  1:21 ` [PATCH 5/7] udf: convert byte order of constant instead of variable marcin.slusarz
2008-01-07 14:52   ` Jan Kara
2008-01-06  1:21 ` [PATCH 6/7] udf: remove UDF_I_* macros and open code them marcin.slusarz
2008-01-07 14:53   ` Jan Kara
2008-01-06  1:21 ` [PATCH 7/7] udf: cache struct udf_inode_info marcin.slusarz
2008-01-07 14:55   ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080107122933.GD3710@infradead.org \
    --to=hch@infradead.org \
    --cc=bfennema@falcon.csc.calpoly.edu \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin.slusarz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.