extern uint32_t ul_crc32(uint32_t seed, const unsigned char *buf, size_t len);
extern uint32_t ul_crc32_exclude_offset(uint32_t seed, const unsigned char *buf, size_t len,
- size_t exclude_off, size_t exclude_len);
+ size_t exclude_off, size_t exclude_len,
+ uint8_t exclude_fill);
#endif
}
uint32_t ul_crc32_exclude_offset(uint32_t seed, const unsigned char *buf, size_t len,
- size_t exclude_off, size_t exclude_len)
+ size_t exclude_off, size_t exclude_len, uint8_t exclude_fill)
{
uint32_t crc = seed;
const unsigned char *p = buf;
unsigned char x = *p++;
if (i >= exclude_off && i < exclude_off + exclude_len)
- x = 0;
+ x = exclude_fill;
crc = crc32_add_char(crc, x);
}
static inline uint32_t count_crc32(const unsigned char *buf, size_t len,
size_t exclude_off, size_t exclude_len)
{
- return (ul_crc32_exclude_offset(~0L, buf, len, exclude_off, exclude_len) ^ ~0L);
+ return (ul_crc32_exclude_offset(~0L, buf, len, exclude_off, exclude_len, 0) ^ ~0L);
}
static inline const unsigned char *get_lba_buffer(blkid_probe pr,
crc = ~ul_crc32_exclude_offset(~0LL, csummed, csummed_size,
offsetof(struct cramfs_super, info.crc),
- sizeof_member(struct cramfs_super, info.crc));
+ sizeof_member(struct cramfs_super, info.crc), 0);
return blkid_probe_verify_csum(pr, crc, expected);
}
uint32_t expected = le32_to_cpu(sb->s_crc);
uint32_t crc = ul_crc32_exclude_offset(
~0LL, (unsigned char *) sb, sizeof(*sb),
- offsetof(__typeof__(*sb), s_crc), sizeof(sb->s_crc));
+ offsetof(__typeof__(*sb), s_crc), sizeof(sb->s_crc), 0);
return blkid_probe_verify_csum(pr, crc, expected);
}
static inline uint32_t count_crc32(const unsigned char *buf, size_t len,
size_t ex_off, size_t ex_len)
{
- return (ul_crc32_exclude_offset(~0L, buf, len, ex_off, ex_len) ^ ~0L);
+ return (ul_crc32_exclude_offset(~0L, buf, len, ex_off, ex_len, 0) ^ ~0L);
}
static inline uint32_t gpt_header_count_crc32(struct gpt_header *header)