[haiku-development] Re: xfs crc checksums

  • From: Raghav Sharma <raghavself28@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 12 Jun 2022 20:00:29 +0530

On Sun, Jun 12, 2022 at 6:07 PM Zenja Solaja <solaja@xxxxxxxxx> wrote:


Also ensure you dont include the CRC bytes themself when calculating the 
buffer’s CRC result. They’re typically never used in the checksum loop, or on 
the odd occassion where these bytes are needed, they must be zeroed 
beforehand. That should be common knowledge, but decades ago when I started 
out and was inexperienced I probably made a similar mistake.

I think the above method for calculating buffer crc doesn't include
it, so we should be fine here.

There are also different endian issues to consider, different CRC 
algoritms/factors, so having a sample dump of a valid buffer’s CRC will help 
you get it right.

I wondered about this, on linux checksum functions at many places
there are _be32 or _le32 instead of _u32 (uint32), I made all of them
uint32 but I think we need to consider endianness as well.

On haiku we have ByteOrder.h to convert endianness, though I haven't
seen declaring variables directly as little endian or big endian like
on linux (_be32, _le32).

--
Raghav

Other related posts: