Show the wanted checksum in bad-superblock-checksum exception

This commit is contained in:
Ming-Hung Tsai 2016-02-27 01:31:24 +08:00
parent d2260dee34
commit b47c02ed8b

View File

@ -91,8 +91,11 @@ namespace {
superblock_disk const *sbd = reinterpret_cast<superblock_disk const *>(raw);
crc32c sum(SUPERBLOCK_CSUM_SEED);
sum.append(&sbd->flags_, MD_BLOCK_SIZE - sizeof(uint32_t));
if (sum.get_sum() != to_cpu<uint32_t>(sbd->csum_))
throw checksum_error("bad checksum in superblock");
if (sum.get_sum() != to_cpu<uint32_t>(sbd->csum_)) {
ostringstream out;
out << "bad checksum in superblock, wanted " << sum.get_sum();
throw checksum_error(out.str());
}
}
virtual void prepare(void *raw, block_address location) const {