[block-cache] Add check_raw() to bcache::validator

This commit is contained in:
Ming-Hung Tsai
2016-02-27 15:21:13 +08:00
parent 45e9916428
commit 778c153c1e
9 changed files with 74 additions and 1 deletions

View File

@@ -44,6 +44,14 @@ namespace {
throw runtime_error("validator check zero");
}
virtual bool check_raw(void const *raw) const {
unsigned char const *data = reinterpret_cast<unsigned char const *>(raw);
for (unsigned b = 0; b < BlockSize; b++)
if (data[b] != 0)
return false;
return true;
}
virtual void prepare(void *raw, block_address location) const {
unsigned char *data = reinterpret_cast<unsigned char *>(raw);
for (unsigned b = 0; b < BlockSize; b++)