]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: drop WRITE_{EQ,CMP}_OPERATORS_5()
authorKefu Chai <tchaikov@gmail.com>
Wed, 3 Aug 2022 03:07:17 +0000 (11:07 +0800)
committerKefu Chai <tchaikov@gmail.com>
Thu, 4 Aug 2022 13:33:51 +0000 (21:33 +0800)
the default-generated comparison operators can fulfill our needs.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/include/cmp.h
src/include/fs_types.h

index 1efe8aa3e47ce08922dbd9daafa438a6ae406e7c..9b39aaab219707479664eb7ea530b2b6e09a4293 100644 (file)
@@ -4,44 +4,6 @@
 /*
  * macros to define comparison operators for classes with small numbers of members.
  */
-#define WRITE_EQ_OPERATORS_5(type, a, b, c, d, e)                      \
-  inline bool operator==(const type &l, const type &r) {               \
-    return l.a == r.a && l.b == r.b && l.c == r.c && l.d == r.d && l.e == r.e; \
-  }                                                                    \
-  inline bool operator!=(const type &l, const type &r) {               \
-    return l.a != r.a || l.b != r.b || l.c != r.c || l.d != r.d || l.e != r.e; \
-  }
-
-#define WRITE_CMP_OPERATORS_5(type, a, b, c, d, e)                     \
-  inline bool operator>(const type &l, const type &r) {                        \
-    return l.a > r.a ||                                                        \
-      (l.a == r.a && (l.b > r.b ||                                     \
-                     (l.b == r.b && (l.c > r.c ||                      \
-                                     (l.c == r.c && (l.d > r.d ||      \
-                                                     (l.d == r.d && l.e > r.e))))))); \
-  }                                                                    \
-  inline bool operator<(const type &l, const type &r) {                        \
-    return l.a < r.a ||                                                        \
-      (l.a == r.a && (l.b < r.b ||                                     \
-                     (l.b == r.b && (l.c < r.c ||                      \
-                                     (l.c == r.c && (l.d < r.d ||      \
-                                                     (l.d == r.d && (l.e < r.e)))))))); \
-  }                                                                    \
-  inline bool operator>=(const type &l, const type &r) {               \
-    return l.a > r.a ||                                                        \
-      (l.a == r.a && (l.b > r.b ||                                     \
-                     (l.b == r.b && (l.c > r.c ||                      \
-                                     (l.c == r.c && (l.d > r.d ||      \
-                                                     (l.d == r.d && l.e >= r.e))))))); \
-  }                                                                    \
-  inline bool operator<=(const type &l, const type &r) {               \
-    return l.a < r.a ||                                                        \
-      (l.a == r.a && (l.b < r.b ||                                     \
-                     (l.b == r.b && (l.c < r.c ||                      \
-                                     (l.c == r.c && (l.d < r.d ||      \
-                                                     (l.d == r.d && l.e <= r.e))))))); \
-  }
-
 #define WRITE_EQ_OPERATORS_7(type, a, b, c, d, e, f, g)                        \
   inline bool operator==(const type &l, const type &r) {               \
     return l.a == r.a && l.b == r.b && l.c == r.c && l.d == r.d && l.e == r.e && l.f == r.f && l.g == r.g; \
index fc34e702a4341d15fa0bc23aed9fc3943b9a952f..72ae6d56f2378c2c8b2fe3d3d793a681d3ccd8a7 100644 (file)
@@ -144,6 +144,8 @@ struct file_layout_t {
       pool_id(-1) {
   }
 
+  bool operator==(const file_layout_t&) const = default;
+
   static file_layout_t get_default() {
     return file_layout_t(1<<22, 1, 1<<22);
   }
@@ -165,8 +167,6 @@ struct file_layout_t {
 };
 WRITE_CLASS_ENCODER_FEATURES(file_layout_t)
 
-WRITE_EQ_OPERATORS_5(file_layout_t, stripe_unit, stripe_count, object_size, pool_id, pool_ns);
-
 std::ostream& operator<<(std::ostream& out, const file_layout_t &layout);
 
 #endif