Lines Matching defs:buffer
18 Calculate the intermediate checksum for a buffer that has the CRC field
20 cksum_offset parameter. We do not modify the buffer during verification,
24 xfs_start_cksum_safe(const char *buffer, size_t length, uint32 cksum_offset)
30 crc = calculate_crc32c(XFS_CRC_SEED, (uint8*)buffer, cksum_offset);
36 return calculate_crc32c(crc, (uint8*)buffer + cksum_offset + sizeof(uint32),
42 Fast CRC method where the buffer is modified. Callers must have exclusive
43 access to the buffer while the calculation takes place.
46 xfs_start_cksum_update(const char *buffer, size_t length, uint32 cksum_offset)
49 *(uint32 *)(buffer + cksum_offset) = 0;
51 // single pass CRC calculation for the entire buffer
52 return calculate_crc32c(XFS_CRC_SEED, (uint8*)buffer, length);
57 Helper to generate the checksum for a buffer.
59 This modifies the buffer temporarily - callers must have exclusive
60 access to the buffer while the calculation takes place.
63 xfs_update_cksum(const char *buffer, size_t length, uint32 cksum_offset)
65 uint32 crc = xfs_start_cksum_update(buffer, length, cksum_offset);
67 *(uint32 *)(buffer + cksum_offset) = ~crc;
72 Helper to verify the checksum for a buffer.
75 xfs_verify_cksum(const char *buffer, size_t length, uint32 cksum_offset)
77 uint32 crc = xfs_start_cksum_safe(buffer, length, cksum_offset);
81 TRACE("buffer = %s, cksum_offset: (%" B_PRIu32 ")\n", buffer, cksum_offset);
83 return *(uint32 *)(buffer + cksum_offset) == (~crc);