diff --git a/thin-provisioning/metadata_checker.cc b/thin-provisioning/metadata_checker.cc index c4572d4..1d064a7 100644 --- a/thin-provisioning/metadata_checker.cc +++ b/thin-provisioning/metadata_checker.cc @@ -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 diff --git a/thin-provisioning/metadata_checker.h b/thin-provisioning/metadata_checker.h index d024138..4db98b8 100644 --- a/thin-provisioning/metadata_checker.h +++ b/thin-provisioning/metadata_checker.h @@ -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 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_; };