From cfb7a9c734d50aefd3db68a04acd645f9d756fb4 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Thu, 27 Apr 2023 17:54:41 +0000 Subject: [PATCH] crimson/osd, osd: define fmt's formatter for ObjectState Signed-off-by: Radoslaw Zarzynski --- .../osd/osd_operations/client_request.cc | 3 ++- src/osd/object_state_fmt.h | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/osd/object_state_fmt.h diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index 7b164376faa9d..1db7052eb9a77 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -11,6 +11,7 @@ #include "crimson/osd/osd_operation_external_tracking.h" #include "crimson/osd/osd_operations/client_request.h" #include "crimson/osd/osd_connection_priv.h" +#include "osd/object_state_fmt.h" namespace { seastar::logger& logger() { @@ -231,7 +232,7 @@ ClientRequest::process_op(instance_handle_t &ihref, Ref &pg) return pg->with_locked_obc( m->get_hobj(), op_info, [this, pg, &ihref](auto obc) mutable { - logger().debug("{}: got obc {}", *this, obc->obs.exists); + logger().debug("{}: got obc {}", *this, obc->obs); return ihref.enter_stage( pp(*pg).process, *this ).then_interruptible([this, pg, obc, &ihref]() mutable { diff --git a/src/osd/object_state_fmt.h b/src/osd/object_state_fmt.h new file mode 100644 index 0000000000000..6b6350b94927d --- /dev/null +++ b/src/osd/object_state_fmt.h @@ -0,0 +1,23 @@ +// -*- 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 types.h classes + */ + +#include "osd/object_state.h" +#include "osd/osd_types_fmt.h" +#if FMT_VERSION >= 90000 +#include +#endif + +template <> +struct fmt::formatter { + constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } + + template + auto format(const ObjectState& os, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "exists {} oi {}", os.exists, os.oi); + } +}; -- 2.39.5