From: Radosław Zarzyński Date: Tue, 24 Oct 2023 21:50:25 +0000 (+0200) Subject: osd: bring the missed fmt::formatter for snapid_t to address FTBFS X-Git-Tag: v17.2.7~1^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F54175%2Fhead;p=ceph.git osd: bring the missed fmt::formatter for snapid_t to address FTBFS This commit is specific to quincy. Signed-off-by: Radosław Zarzyński --- diff --git a/src/include/object_fmt.h b/src/include/object_fmt.h new file mode 100644 index 00000000000..d27821bbea6 --- /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 3165e4d70fb..f4782778651 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"