Re: [PATCH 05/13] xfs: add CRC infrastructure

Josef 'Jeff' Sipek
2009-02-12T06:10:50Z

On Tue, Feb 10, 2009 at 03:22:46PM -0500, Christoph Hellwig wrote:
...
> Index: xfs/fs/xfs/xfs_cksum.h
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ xfs/fs/xfs/xfs_cksum.h 2009-02-05 19:04:31.282972630 +0100
> @@ -0,0 +1,62 @@
> +#ifndef _XFS_CKSUM_H
> +#define _XFS_CKSUM_H 1
> +
> +#define XFS_CRC_SEED (~(__uint32_t)0)

Is this the final seed you want to use, or was this just a
work-in-progress-non-zero value for testing?

...
> +/*
> + * Convert the intermediate checksum to the final ondisk format.
> + *
> + * Note that crc32c is already endianess agnostic, so no additional
> + * byte swap is needed.
> + */
> +static inline __be32
> +xfs_end_cksum(__uint32_t crc)
> +{
> + return (__force __be32)~crc;
> +}

Why the bit-wise not?

Josef 'Jeff' Sipek.

--
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan