add equality operators for the metadata_damage classes.

This commit is contained in:
Joe Thornber 2013-04-29 16:12:05 +01:00
parent 969a5f62c6
commit 5e26d51372
2 changed files with 56 additions and 0 deletions

View File

@ -46,6 +46,12 @@ super_block_corruption::visit(metadata_damage_visitor &visitor) const
visitor.visit(*this);
}
bool
super_block_corruption::operator ==(super_block_corruption const &rhs) const
{
return true;
}
//--------------------------------
missing_device_details::missing_device_details(range64 missing)
@ -59,6 +65,12 @@ missing_device_details::visit(metadata_damage_visitor &visitor) const
visitor.visit(*this);
}
bool
missing_device_details::operator ==(missing_device_details const &rhs) const
{
return missing_ == rhs.missing_;
}
//--------------------------------
missing_devices::missing_devices(range64 missing)
@ -72,6 +84,12 @@ missing_devices::visit(metadata_damage_visitor &visitor) const
visitor.visit(*this);
}
bool
missing_devices::operator ==(missing_devices const &rhs) const
{
return missing_ == rhs.missing_;
}
//--------------------------------
missing_mappings::missing_mappings(uint64_t dev, range64 missing)
@ -86,6 +104,12 @@ missing_mappings::visit(metadata_damage_visitor &visitor) const
visitor.visit(*this);
}
bool
missing_mappings::operator ==(missing_mappings const &rhs) const
{
return dev_ == rhs.dev_ && missing_ == rhs.missing_;
}
//--------------------------------
bad_metadata_ref_count::bad_metadata_ref_count(block_address b,
@ -103,6 +127,12 @@ bad_metadata_ref_count::visit(metadata_damage_visitor &visitor) const
visitor.visit(*this);
}
bool
bad_metadata_ref_count::operator ==(bad_metadata_ref_count const &rhs) const
{
return b_ == rhs.b_ && actual_ == rhs.actual_ && expected_ == rhs.expected_;
}
//--------------------------------
bad_data_ref_count::bad_data_ref_count(block_address b,
@ -120,6 +150,12 @@ bad_data_ref_count::visit(metadata_damage_visitor &visitor) const
visitor.visit(*this);
}
bool
bad_data_ref_count::operator ==(bad_data_ref_count const &rhs) const
{
return b_ == rhs.b_ && actual_ == rhs.actual_ && expected_ == rhs.expected_;
}
//--------------------------------
missing_metadata_ref_counts::missing_metadata_ref_counts(range64 missing)
@ -133,6 +169,12 @@ missing_metadata_ref_counts::visit(metadata_damage_visitor &visitor) const
visitor.visit(*this);
}
bool
missing_metadata_ref_counts::operator ==(missing_metadata_ref_counts const &rhs) const
{
return missing_ == rhs.missing_;
}
//--------------------------------
missing_data_ref_counts::missing_data_ref_counts(range64 missing)
@ -146,6 +188,12 @@ missing_data_ref_counts::visit(metadata_damage_visitor &visitor) const
visitor.visit(*this);
}
bool
missing_data_ref_counts::operator ==(missing_data_ref_counts const &rhs) const
{
return missing_ == rhs.missing_;
}
//--------------------------------
void

View File

@ -53,6 +53,7 @@ namespace thin_provisioning {
class super_block_corruption : public metadata_damage {
void visit(metadata_damage_visitor &visitor) const;
bool operator ==(super_block_corruption const &rhs) const;
};
typedef range<uint64_t> range64;
@ -60,6 +61,7 @@ namespace thin_provisioning {
struct missing_device_details : public metadata_damage {
missing_device_details(range64 missing);
virtual void visit(metadata_damage_visitor &visitor) const;
bool operator ==(missing_device_details const &rhs) const;
range64 missing_;
};
@ -67,6 +69,7 @@ namespace thin_provisioning {
struct missing_devices : public metadata_damage {
missing_devices(range64 missing);
virtual void visit(metadata_damage_visitor &visitor) const;
bool operator ==(missing_devices const &rhs) const;
range64 missing_;
};
@ -74,6 +77,7 @@ namespace thin_provisioning {
struct missing_mappings : public metadata_damage {
missing_mappings(uint64_t dev, range64 missing);
virtual void visit(metadata_damage_visitor &visitor) const;
bool operator ==(missing_mappings const &rhs) const;
uint64_t dev_;
range64 missing_;
@ -85,6 +89,7 @@ namespace thin_provisioning {
ref_t expected);
virtual void visit(metadata_damage_visitor &visitor) const;
bool operator ==(bad_metadata_ref_count const &rhs) const;
block_address b_;
ref_t actual_;
@ -97,6 +102,7 @@ namespace thin_provisioning {
ref_t expected);
virtual void visit(metadata_damage_visitor &visitor) const;
bool operator ==(bad_data_ref_count const &rhs) const;
block_address b_;
ref_t actual_;
@ -106,6 +112,7 @@ namespace thin_provisioning {
struct missing_metadata_ref_counts : public metadata_damage {
missing_metadata_ref_counts(range64 missing);
virtual void visit(metadata_damage_visitor &visitor) const;
bool operator ==(missing_metadata_ref_counts const &rhs) const;
range64 missing_;
};
@ -113,6 +120,7 @@ namespace thin_provisioning {
struct missing_data_ref_counts : public metadata_damage {
missing_data_ref_counts(range64 missing);
virtual void visit(metadata_damage_visitor &visitor) const;
bool operator ==(missing_data_ref_counts const &rhs) const;
range64 missing_;
};