From 9e67a437a37f82e8191777bce659905b66b8e88e Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Wed, 30 Nov 2022 16:18:31 -0500 Subject: [PATCH] cls/fifo: Use spaceship operator to implement comparisons Except for the version type, where only versions with the same tag are comparable. Fixes: https://tracker.ceph.com/issues/57562 Signed-off-by: Adam C. Emerson --- src/cls/fifo/cls_fifo_types.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/cls/fifo/cls_fifo_types.h b/src/cls/fifo/cls_fifo_types.h index cc02a5dcd45..5c7e6769ea3 100644 --- a/src/cls/fifo/cls_fifo_types.h +++ b/src/cls/fifo/cls_fifo_types.h @@ -105,11 +105,7 @@ struct data_params { void dump(ceph::Formatter* f) const; void decode_json(JSONObj* obj); - bool operator ==(const data_params& rhs) const { - return (max_part_size == rhs.max_part_size && - max_entry_size == rhs.max_entry_size && - full_size_threshold == rhs.full_size_threshold); - } + auto operator <=>(const data_params&) const = default; }; WRITE_CLASS_ENCODER(data_params) inline std::ostream& operator <<(std::ostream& m, const data_params& d) { @@ -152,10 +148,7 @@ struct journal_entry { } void dump(ceph::Formatter* f) const; - friend bool operator ==(const journal_entry& lhs, const journal_entry& rhs) { - return (lhs.op == rhs.op && - lhs.part_num == rhs.part_num); - } + auto operator <=>(const journal_entry&) const = default; }; WRITE_CLASS_ENCODER(journal_entry) inline std::ostream& operator <<(std::ostream& m, const journal_entry::Op& o) { -- 2.39.5