]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: bring the missed fmt::formatter for snapid_t to address FTBFS 54175/head
authorRadosław Zarzyński <rzarzyns@redhat.com>
Tue, 24 Oct 2023 21:50:25 +0000 (23:50 +0200)
committerRadosław Zarzyński <rzarzyns@redhat.com>
Tue, 24 Oct 2023 21:50:28 +0000 (23:50 +0200)
This commit is specific to quincy.

Signed-off-by: Radosław Zarzyński <rzarzyns@redhat.com>
src/include/object_fmt.h [new file with mode: 0644]
src/osd/scrubber/pg_scrubber.cc

diff --git a/src/include/object_fmt.h b/src/include/object_fmt.h
new file mode 100644 (file)
index 0000000..d27821b
--- /dev/null
@@ -0,0 +1,30 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+#pragma once
+
+/**
+ * \file fmtlib formatters for some object.h structs
+ */
+#include <fmt/format.h>
+
+#include "object.h"
+
+
+template <>
+struct fmt::formatter<snapid_t> {
+
+  constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
+
+  template <typename FormatContext>
+  auto format(const snapid_t& snp, FormatContext& ctx) const
+  {
+    if (snp == CEPH_NOSNAP) {
+      return fmt::format_to(ctx.out(), "head");
+    }
+    if (snp == CEPH_SNAPDIR) {
+      return fmt::format_to(ctx.out(), "snapdir");
+    }
+    return fmt::format_to(ctx.out(), "{:x}", snp.val);
+  }
+};
+
index 3165e4d70fb62d9b2b30b7aeaa89911c0991b4fb..f478277865136bea02d606fef3eeaab2983991fb 100644 (file)
@@ -10,6 +10,7 @@
 #include "debug.h"
 
 #include "common/errno.h"
+#include "include/object_fmt.h"
 #include "messages/MOSDOp.h"
 #include "messages/MOSDRepScrub.h"
 #include "messages/MOSDRepScrubMap.h"