From 07c14436f9c626c02af8c381642518c1ca9dffa4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rados=C5=82aw=20Zarzy=C5=84ski?= Date: Tue, 24 Oct 2023 23:50:25 +0200 Subject: [PATCH] osd: bring the missed fmt::formatter for snapid_t to address FTBFS MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit is specific to quincy. Signed-off-by: Radosław Zarzyński --- src/include/object_fmt.h | 30 ++++++++++++++++++++++++++++++ src/osd/scrubber/pg_scrubber.cc | 1 + 2 files changed, 31 insertions(+) create mode 100644 src/include/object_fmt.h diff --git a/src/include/object_fmt.h b/src/include/object_fmt.h new file mode 100644 index 0000000000000..d27821bbea6a3 --- /dev/null +++ b/src/include/object_fmt.h @@ -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 + +#include "object.h" + + +template <> +struct fmt::formatter { + + constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } + + template + 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); + } +}; + diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index 3165e4d70fb62..f478277865136 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -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" -- 2.39.5